#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int a, b;
int count = 0;
while (cin >> a >> b)
{
for (int i = a; i <= b; i++)
{
if (i == 2)
{
count++;
}
else if (i != 1 && i % 2 != 0)
{
for (int j = 1; j <= int(sqrt(i)); j++)
{
if (i % j == 0 && j != 1)
{
break;
}
else if (j == int(sqrt(i)))
{
count++;
}
}
}
}
cout << count << endl;
}
return 0;
}