#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int isok[1000010], ans;
int main() {
freopen("squares.in", "r", stdin);
freopen("squares.out", "w", stdout);
int n; scanf("%d", &n);
for (register int i = 1; i <= 500; i ++)
isok[i * i] = 1;
for (register int i = 1; i <= 500; i ++)
if (isok[i * i + n] == 1) ans ++;
printf("%d\n", ans);
return 0;
}