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