n = int(input()) ret = 0 for x in range(1, n): yy = n * n - x * x ynear = int(yy**0.5) for y in [ynear-1, ynear, ynear+1]: if y * y == yy: ret += 1 print(ret)