n = int(input()) ans = 0 for x in range(1,n): if (n*n-x*x)**0.5==int((n*n-x*x)**0.5): ans += 1 print(ans)