n = int(input()) lim = int(((n**2)//2)**.5)+1 cnt = 0 for i in range(1,lim): for j in range(1,lim): if i**2+j**2==n**2: cnt+= 1 print(cnt)