n = int(input()) nn = int(n**0.5) + 1 ret = 0 for x in range(1, nn): for y in range(1, nn): if x * x + y * y == n: ret += 1 print(ret)