import sys import math sys.setrecursionlimit(10 ** 7) input = sys.stdin.readline f_inf = float('inf') MOD = 10 ** 9 + 7 def solve(): n = int(input()) nn = n * n res = 0 for x in range(1, n): xx = x * x l = int(math.sqrt(nn - xx)) for y in range(l - 1, l + 1): if x * x + y * y == nn: res += 1 break print(res) if __name__ == '__main__': solve()