from math import isqrt N = int(input()) ans = 0 for x in range(1,N): y2 = N*N - x*x sq = isqrt(y2) if(sq*sq != y2):continue ans += 1 print(ans)