N = int(input()) ans = 0 n = int(pow(N,0.5)) L = set([i**2 for i in range(n+1)]) for i in range(n+1): if N - i ** 2 in L: ans += 1 print(ans)