#include<iostream>
using namespace std;
int main(){
	int n,m,h=0,s,i;
	cin>>m>>n;
	for(;m<=n;m++){
		if(m==1){
			m++;
		}
		s=0;
		for(i=2;i<=sqrt(m);i++){
			if(m%i==0){
				s++;
			}	
		
		}
		if(s==0){
			h++;
			}
		}
		cout<<h;
		return 0;
}

/**************************************************************
	Problem: 1063
	User: linweilun
	Language: C++
	Result: Compile Error
****************************************************************/