#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b,i,j,x=0,s=0;
    cin>>a>>b;
    for(i=a;i<=b;i++){
        x=0;
        for(j=2;j<=sqrt(i);j++){
            if(i%j==0){
                x++;
            }
        }
        if(x==0&&i!=1)
        s++;
    }cout<<s;
}
/**************************************************************
	Problem: 1063
	User: wangyiyang
	Language: C++
	Result: Accepted
	Time:21 ms
	Memory:2072 kb
****************************************************************/