#!/usr/bin/env python3 # from typing import * import sys import io import math import collections import decimal import itertools import bisect import heapq def input(): return sys.stdin.readline()[:-1] # sys.setrecursionlimit(1000000) # _INPUT = """5 # """ # sys.stdin = io.StringIO(_INPUT) INF = 10**10 N = int(input()) n = 0 x = 1 while True: if x*x + 1 > N*N: break y = int(math.sqrt(N*N - x*x + 0.001)) if x*x + y*y == N*N: n += 1 x += 1 print(n)