#include #include #include #include #include #include #include #include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); //cout << fixed << setprecision(15); int l , r; cin >> l >> r; vector prime(2200000 , 0); prime[1] = 2; for (int i = 2; i <= 2000000; i++) { for (int j = i; j <= 2000000; j += i) { prime[j]++; } } long long ans = 0; for (int i = l; i <= r; i++) { if (prime[i] <= 1) ans++; } for (int i = l; i <= r - 1; i++) { if (prime[i + i + 1] <= 1) ans++; } cout << ans << endl; return 0; }