#include <stdio.h>
#include <stdlib.h>
int yesornot(int n){
int j = 0;
int flag = 0;
for(j=2;j<=n-1;j++){
if(n%j==0){
flag = 1;
break;}
}
return flag ;
}
int main(){
int a,b;
while(scanf("%d%d",&a,&b)!=EOF){
int count = 0;
int i;
for(i=a;i<=b;i++){
if(yesornot(i)==0)
{count++;}
}
printf("%d\n",count);
}
return 0;
}