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