n = int(input()) ret = 0 for x in range(1, n): yy = n * n - x * x i = 1 while i*i<=yy: if i * i == yy: ret += 1 i += 1 print(ret)