#include <iostream> #include<math.h> using namespace std; typedef long long ll; #define maxn 10000000 bool IsPrime[maxn]; void init() { ll i = 2; for(i;i < maxn; i ++) { IsPrime[i] = true; } IsPrime[0] = IsPrime[1] = false; } int main() { ll a,b,sum; init(); while(cin >> a >> b) { ll i,j; for(i = 1;i <= a;i ++) { if(IsPrime[i] == true) { for(j = 2;i*j <= b;j ++) IsPrime[i*j] = false; } } ll ans = 0; for(i = a;i <= b;i ++) { if(IsPrime[i]) ans ++; } cout << ans << endl; } return 0; }