#include<bits/stdc++.h>
using namespace std;
bool lan(long long x){
for(int i=2;i*i<=x;i++){
if(x%i==0){
return false;
}
}
return true;
}
int main(){
long long l,r,ans=0;
cin>>l>>r;
for(int i=l;i<=r;i++){
if(lan(i)){
ans++;
}
}
cout<<ans;
return 0;
}