N = int(input()) import math ans = 0 for i in range(1, N): y = math.sqrt(N**2-i**2) if y.is_integer(): ans += 1 print(ans)