#include<bits/stdc++.h>
using namespace std;
int zs(int x){
int s=1;
for(int i=2;i*i<=x;i++){
if(x%i==0){
s=0;
}
}
if(x==1){
return false;
}else if(s==1){
return true;
}else{
return false;
}
}
int main(){
int n,a;
int s1=0;
cin>>a>>n;
for(int i=a;i<=n;i++){
int b=zs(i);
if(b==1){
s1+=1;
}
}
cout<<s1<<endl;
return 0;
}