#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING

#include <bits/stdc++.h>

using namespace std;

int main() {
    int m, n;
    scanf("%d%d", &m, &n);
    list<int> lst;
    for (int i = 1; i <= n; i += 2)
        lst.push_back(i);
    int modcnt = 0, st = 3, rcnt = 2;
    do {
        modcnt = 0;
        int poscnt = 1;
        for (list<int>::iterator ite = lst.begin(); ite != lst.end(); poscnt++)
            if (poscnt == rcnt) {
                st = *ite++;
            } else if (poscnt % st == 0) {
                lst.erase(ite++);
                modcnt++;
            } else ++ite;
        rcnt++;
    } while (modcnt);
    int ans = 0;
    for (list<int>::iterator ite = lst.begin(); ite != lst.end(); ++ite)
        if (m < *ite && *ite < n)
            ans++;
    printf("%d", ans);
    return 0;
}
