target=50000001
d=[1]*target
r=0
n=2
while n < target:
x=2*n*n-1
if d[n] < x:
if d[n]==1:
r+=1
p=x/d[n]
for i in range(p+n,target,p):
m=2*i*i-1
y=p
while m%y==0:
y*=p
y/=p
d[i]*=y
for i in range(p-n,target,p):
m=2*i*i-1
y=p
while m%y==0:
y*=p
y/=p
d[i]*=y
if n < 100 or (n < 1000 and n%100==0) or (n < 10000 and n%1000==0) or n%10000==0:print n,"checked"
n+=1
print r