N = int(input()) ans = 0 for x in range(1,N): y = (N**2-x**2)**0.5 if y.is_integer(): ans += 1 print(ans)