#include <stdio.h>
#define MAX 100000
int isPrime (int num) {
int a = 0;
for (int i=2; i <= num-1;i++){
if (num % i == 0){
a++;
break;
}
}
if (a==0){
return 1;
}else{
return -1;
}
}
int main () {
int f[MAX]={};
f[1] = 1;
for(int i = 2 ; i < MAX; i++){
if(isPrime(i) == 1){
f[i] = f[i-1] + 1;
}else{
f[i] = f[i-1];
}
}
int m,n, count;
while(scanf("%d%d",&m,&n)!=EOF){
count = f[n] - f[m-1];
printf("%d\n", count);
count = 0;
}
return 0;
}