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