from math import gcd l=int(input()) c=0 for i in range(1,10**3): for j in range(i+1,10**3+1): if 8*((j**2)+j*i)<=l and gcd(gcd(i**2+j**2,2*i*j),j**2-i**2)==1: c+=1 print(c%(10**6+3))