#include <iostream>
using namespace std;
int main() {
int a = 0, b = 0, cnt = 0;
cin >> a >> b;
for (int j = a; j <= b; j++) {
bool is = true;
for (int i = 2; i * i <= j; i++) {
if (j % i == 0) {
is = false;
break;
}
}
if (is)
cnt++;
}
cout << cnt << endl;
return 0;
}