#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int a, b;
cin >> a >> b;
int c = 0;
for (int i = a; i <= b; i++)
{
int n = i;
bool f = true;
for (int j = 2; j <= sqrt(n); j++)
{
if (n % j == 0)
{
f = false;
break;
}
}
if (f)
c++;
}
cout << c;
return 0;
}