#define _USE_MATH_DEFINES #include using namespace std; //template #define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define ALL(v) (v).begin(),(v).end() using ll=long long int; const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12; templateinline bool chmax(T& a,T b){if(ainline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;} bool Miller(ll n){ if(n<2 or (n&1)==0)return (n==2); ll d=n-1; while((d&1)==0)d>>=1; vector seeds; auto MP=[&](ll x,ll t,ll m)->ll{ ll res=1; while(t){ if(t&1)res=(__int128_t(res)*x)%m; x=(__int128_t(x)*x)%m; t>>=1; } return res; }; if(n<(1<<30))seeds={2, 7, 61}; else seeds={2, 325, 9375, 28178, 450775, 9780504}; for(auto& x:seeds){ if(n<=x)break; ll t=d,y=MP(x,t,n); while(t!=n-1 and y!=1 and y!=n-1){ y=(__int128_t(y)*y)%n; t<<=1; } if(y!=n-1 and (t&1)==0)return 0; } return 1; } int main(){ int L,R; cin>>L>>R; int res=0; rep(a,L,R+1){ if(Miller(a))res++; if(a!=R and Miller(a*2+1))res++; } cout<