N = int(input())**2 ans = 0 for x in range(1, int(N**0.5)+1): x **= 2 y = N-x if 1 <= y and int(y**0.5)**2 == y: ans += 1 print(ans)