def is_square(n): ok, ng = 0, n+1 while ng - ok > 1: mid = (ok + ng) // 2 if mid*mid <= n: ok = mid else: ng = mid return (ok * ok == n) n = int(input()) ans = 0 for x in range(1, n): y2 = n*n - x*x if is_square(y2): ans += 1 print(ans)