#include<bits/stdc++.h>
using namespace std;
bool f(long long x)
{
if(x <= 1)
return 0;
for(int i = 2; i * i <= x; i ++)
if(x % i == 0)
return 0;
return 1;
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
long long a, b, ans = 0;
cin >> a >> b;
for(int i = a; i <= b; i ++)
if(f(i))
ans ++;
cout << ans;
return 0;
}