#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int prime(long int );
int main(int argc, char *argv[]) {
long int a,b;
while(scanf("%ld%ld",&a,&b)!=EOF){
long int times=0,i;
for(i=a;i<=b;i++){
if(i==2) times++;
if(i%2==1){
if(prime(i)) times++;
}
}
printf("%ld\n",times);
}
return 0;
}
int prime(long int n){
int i;
if(n<=1){
return 0;
}else{
for(i=2;i<=sqrt(n);i++){
if(n%i==0) return 0;
}
return 1;
}
}