#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
//using namespace atcoder;
using ll = long long;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
//typedef vector<vector<int> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a >= b) { a = b; return 1; } return 0; }
const ll INF = 1e18;

#define debug(v) cout<<#v<<": ",prt(v);
template <typename A,typename B>
inline void prt(pair<A,B> p){cout<<"("<<p.first<<", "<<p.second<<")\n";}
template <typename A,typename B,typename C>
inline void prt(tuple<A,B,C> p){cout<<"("<<get<0>(p)<<", "<<get<1>(p)<<", "<<get<2>(p)<<")\n";}
inline void prt(bool p){if(p)cout<<"True"<<'\n';else cout<<"False"<<'\n';}
template <typename T> 
inline void prt(vector<T> v){cout<<'{';for(ll i=0;i<v.size();i++){cout<<v[i];if(i<v.size()-1)cout<<", ";}cout<<'}'<<'\n';}
template<typename T> 
inline void prt(vector<vector<T> >& vv){ for(const auto& v : vv){ prt(v); } }
template <typename T> 
inline void prt(deque<T> v){cout<<'{';for(ll i=0;i<v.size();i++){cout<<v[i];if(i<v.size()-1)cout<<", ";}cout<<'}'<<'\n';}
template <typename A,typename B>
inline void prt(map<A,B> v){cout<<'{';ll c=0;for(auto &p: v){cout<<p.first<<":"<<p.second;c++;if(c!=v.size())cout<<", ";}cout<<'}'<<'\n';}
template <typename A,typename B>
inline void prt(unordered_map<A,B> v){cout<<'{';ll c=0;for(auto &p: v){cout<<p.first<<":"<<p.second;c++;if(c!=v.size())cout<<", ";}cout<<'}'<<'\n';}
template <typename T> 
inline void prt(set<T> v){cout<<'{';for(auto i=v.begin();i!=v.end();i++){cout<<*i;if(i!=--v.end())cout<<", ";}cout<<'}'<<'\n';}
template <typename T> 
inline void prt(multiset<T> v){cout<<'{';for(auto i=v.begin();i!=v.end();i++){cout<<*i;if(i!=--v.end())cout<<", ";}cout<<'}'<<'\n';}

/*
S={2,3,5,7,11,13,17,19,}
dp[i][S]=i番目の数まで見た時に使った素数の集合がSであるような選び方の場合の数
dp[0][0]=1
ans:dp[b-a][j](jは任意)
今考えている数:m
dp[i+1][S|(mの素因数)](mの素因数とSのbitがかぶっている時は遷移しない)
*/

/*  divisor(n)
    入力：整数 n
    出力：nのすべての約数
    計算量：O(√n)
*/
vector<ll>divisor(ll n){
    vector<ll>ret;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            ret.push_back(i);
            if(i*i!=n)ret.push_back(n/i);
        }
    }
    sort(ret.begin(),ret.end());
    return ret;
}


int main(){
	ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	ll a,b;
	cin >> a >> b;
	vector<ll>prime;
	for(int i=1;i<=b-a;i++){
		if(divisor(i).size()==2)prime.push_back(i);
	}
	ll psz = prime.size();
	vector<vector<ll> >dp(b-a+2,vector<ll>(1<<psz,0));
	dp[0][0]=1;
	map<ll,ll>mp;
	for(ll m=a;m<=b;m++){
		ll bit = 0;
		rep(j,prime.size()){
			if(m%prime[j]==0)bit|=(1<<j);
		}	
		mp[m]=bit;
	}
	for(ll m=a;m<=b;m++){
		rep(s,(1<<psz)){
			ll i = m-a;
			//if(__builtin_popcount(s)!=i)continue;
			dp[i+1][s]+=dp[i][s];
			ll bit = mp[m];
			if((s^bit)!=(s|bit))continue;
			dp[i+1][s|bit]+=dp[i][s];
		}
	}
	//debug(dp);
	cout << accumulate(dp[b-a+1].begin(),dp[b-a+1].end(),0) << endl;

	return 0;
}
#include<stdio.h>
#define rep(i,N) for(long i=0;i<(long)N;i++)
const int d[20]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71};
static inline long IN(void)
{
  long x=0,f=0,c=getchar();while(c<48||c>57){f^=(c==45),c=getchar();}
  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;
}
static inline void OUT(long x){if(x<0){putchar('-'),x=-x;}if(x>=10){OUT(x/10);}putchar(x%10+48);}
int bitdp[1<<20]={1};
int main(void)
{
  long A=IN(),B=IN(),num=0,result=0;
  rep(i,B-A+1)
  {
    num=0;
    rep(j,20){if(((i+A)%d[j])==0){num+=(1<<j);}}
    rep(j,1<<20){if(j&num){continue;}bitdp[j|num]+=bitdp[j];}
  }
  rep(i,1<<20){result+=bitdp[i];}
  OUT(result);
}