z=int(input()) m=0 for x in range(1,z): y =int((z*z-x*x)**0.5+0.5) if x*x+y*y==z*z: m+=1 print(m)