#include<bits/stdc++.h>
using namespace std;
const int N=(1<<20)+10;
int primes[20]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71};
long long  f[N];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	long long a,b;
	cin>>a>>b;
	f[0]=1;
	for(long long i=a;i<=b;++i){
		int res=0;
		for(int j=0;j<20;++j){
			if(i%primes[j]==0)res|=(1<<j);
		}
		for(int j=0;j<(1<<20);++j){
			if(!(res&j))f[res|j]+=f[j];
		}
	}
	long long ans=0;
	for(int i=0;i<(1<<20);++i)ans+=f[i];
	cout<<ans<<"\n";
    return 0;
}
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

ll gcd(ll a,ll b){
    return b==0?a:gcd(b,a%b);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll A,B;
  cin>>A>>B;

  vector<ll> v;
  for(ll i=A;i<=B;i++) v.push_back(i);
  int V=v.size();

  vector<vector<int>> g(V);
  rep(i,V){
      for(int j=i+1;j<V;j++){
          if(gcd(v[i],v[j])!=1){
              g[i].push_back(j);
              g[j].push_back(i);
          }
      }
  }

  ll ast=0,bst=0;
  rep(k,V){
      if(k<60) ast+=(1ll<<k);
      else bst+=(1ll<<(k-60));
  }

  map<tuple<int,ll,ll>,ll> dp;
  auto solve = [&](auto &&solve,int now,ll ast,ll bst)->ll{
      if(dp.count(mkt(now,ast,bst))) return dp[mkt(now,ast,bst)];
      if(now==V) return 1;

      ll res=0;
      {
          ll nexast=ast,nexbst=bst;
          if(now<60&&((1ll<<now)&ast)) nexast^=(1ll<<now);
          if(now>=60&&((1ll<<(now-60))&bst)) nexbst^=(1ll<<(now-60));
          res+=solve(solve,now+1,nexast,nexbst);
      }
      //res+=solve(solve,now+1,ast,bst);
      if(now<60&&((1ll<<now)&ast)){
        ll nexast=ast,nexbst=bst;
        nexast^=(1ll<<now);
        for(auto j:g[now]){
            if(j<60&&(ast&(1ll<<j))) nexast^=(1ll<<j);
            if(j>=60&&(bst&(1ll<<(j-60)))) nexbst^=(1ll<<(j-60));
        }
        res+=solve(solve,now+1,nexast,nexbst);
      }
      if(now>=60&&((1ll<<(now-60))&bst)){
        ll nexast=ast,nexbst=bst;
        nexbst^=(1ll<<(now-60));
        for(auto j:g[now]){
            if(j<60&&(ast&(1ll<<j))) nexast^=(1ll<<j);
            if(j>=60&&(bst&(1ll<<(j-60)))) nexbst^=(1ll<<(j-60));
        }
        res+=solve(solve,now+1,nexast,nexbst);
      }
      return dp[mkt(now,ast,bst)]=res;
  };

  ll ans=solve(solve,0,ast,bst);
  cout<<ans<<endl;

  return 0;
}
