#include <bits/stdc++.h>
using namespace std;
int main() {
    int a,b,cnt = 0;
    bool isPrime = true;
    cin >> a >> b;
    for (int i = a;i <= b;i++) {
        for (int j = 2;j <= sqrt(i);j++) {
            if (i % j == 0) {
                isPrime = false;
            }
        }
        if (isPrime) {
            cnt++;
        } else {
            isPrime = true;
        }
    }
    cout << cnt;
    return 0;
}