#include <bits/stdc++.h>
using namespace std;
bool miku(int n){
for (int i = 2; i * i <= n; i++) if (n % i == 0) return 0;
return 1;
}
int main(){
ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
int n,m; cin >> n >> m;
int cnt = 0 , c = 0;
for (int i = 1; i * i <= m; i++){
if (miku(i)) ++cnt;
}
for (int i = 1; i * i <= n - 1; i++){
if (miku(i)) ++c;
}
cout << cnt - c;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiBib29sIG1pa3UoaW50IG4pewogICAgZm9yIChpbnQgaSA9IDI7IGkgKiBpIDw9IG47IGkrKykgaWYgKG4gJSBpID09IDApIHJldHVybiAwOwogICAgcmV0dXJuIDE7CiB9CmludCBtYWluKCl7CiAgICBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKGZhbHNlKTsgY2luLnRpZShudWxscHRyKTsgY291dC50aWUobnVsbHB0cik7CiAgICBpbnQgbixtOyBjaW4gPj4gbiA+PiBtOwogICAgaW50IGNudCA9IDAgLCBjID0gMDsKICAgIGZvciAoaW50IGkgPSAxOyBpICogaSA8PSBtOyBpKyspewogICAgICAgIGlmICAobWlrdShpKSkgKytjbnQ7CiAgICB9CiAgICBmb3IgKGludCBpID0gMTsgaSAqIGkgPD0gbiAtIDE7IGkrKyl7CiAgICAgICAgaWYgKG1pa3UoaSkpICsrYzsKICAgIH0KICAgIGNvdXQgPDwgY250IC0gYzsKICAgICAgcmV0dXJuIDA7Cn0=