#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;
}

#include <bits/stdc++.h>

using namespace std;

typedef long long   ll;

const ll p[20] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71};

vector< ll > nums;
ll dp[(1 << 20) + 10][73];

bool can(int i, int msk, int &sub){
    auto num = nums[i];

    for(int i = 0 ; i < 20 ; i++){
        if(num % p[i] == 0){
            int e = 1 << i;
            if(msk & e){
                return false;
            }else{
                sub |= e;
            }
        }
    }

    return true;
}

ll solve(int i, int msk) {
    auto &ans = dp[msk][i];

    if(ans != -1){
        return ans;
    }

    // printf("aqui! %d %lu\n", i, nums.size());
    if(i == nums.size()){
        return ans = 1LL;
    }

    int sub = 0;
    ans = 0;
    if(can(i, msk, sub)){
        ans += solve(i + 1, msk | sub);
    }

    ans += solve(i + 1, msk);

    // printf("%d %lld\n", i, ans);

    return ans;
}

int main(){
    memset(dp, -1, sizeof dp);
    ll a, b;

    scanf("%lld %lld", &a, &b);

    while(a <= b){
        nums.push_back(a);
        a++;
    }

    printf("%lld\n", solve(0, 0));

    return 0;
}