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