#include<iostream>
using namespace std;
int main()
{
int a,b,i,j;
while(cin>>a>>b)
{
int sum=0;
if(!(b==1))//測資517 a=1 b=1
{
if(a%2==0)
a++;
for(i=a; i<=b; i=i+2)
{
bool buttom=true;
for(j=3; j<i&&j<=10000; j=j+2)// 要多j<=10000條件不然太大,因題目b<=100000000
if(i%j==0)
{
buttom=false;
break;
}
if(buttom)
sum++;
}
}
cout<<sum<<endl;
}
}