#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define ins insert

#define debug(a) cerr<<(a)<<endl
#define dbrep(a,n) rep(_i,n) cerr<<(a[_i])<<" "; cerr<<endl
#define dbrep2(a,n,m) rep(_i,n){rep(_j,m) cerr<<(a[_i][_j])<<" "; cerr<<endl;}

using namespace std;

template<class A, class B>
ostream &operator<<(ostream &os, const pair<A,B> &p){return os<<"("<<p.fi<<","<<p.se<<")";}
template<class A, class B>
istream &operator>>(istream &is, pair<A,B> &p){return is>>p.fi>>p.se;}

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

ll dp[80][1<<20];

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll A,B; cin>>A>>B;
    ll N = B-A+1;
    debug(N);

    vll v(N);
    rep(i,N){
        rep(j,20){
            if ((A+i)%primes[j]==0){
                v[i]|=1<<j;
            }
        }
    }
    // rep(i,N){
    //     rep(j,20)if(v[i]>>j&1){
    //         cout<<1<<" ";
    //     }else{
    //         cout<<0<<" ";
    //     }
    //     cout<<endl;
    // }
    dp[0][0]=1;
    rep(i,N)rep(j,1<<20){
        dp[i+1][j]+=dp[i][j];
        if ((j&v[i])==0){
            dp[i+1][j|v[i]]+=dp[i][j];
        }
    }
    ll ans=0;
    rep(j,1<<20){
        ans+=dp[N][j];
    }
    cout<<ans<<"\n";
    return 0;
}

#include <bits/stdc++.h>

//#pragma GCC optimize(2)
using namespace std;
#define int long long
typedef long long LL;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int inf = 1e18;
const int mod = 998244353;
//const int mod = 1e9 + 7;
const int maxn = 2e5 + 10;
const int N = 25e5 + 100;

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

void solve() {
    int a,b;
    cin>>a>>b;
    dp[0]=1;
    for (int i = a; i <=b; ++i) {
        int res=0;
        for (int j = 0; j < 20; ++j) {
            if (i%p[j]==0) res|=1<<j;
        }
        for (int j = 0; j < 1 << 20; ++j) {
            if (!(res&j)){
                dp[j|res]+=dp[j];
            }
        }
    }
    int ans=0;
    for (int k = 0; k < 1 << 20; ++k) {
        ans+=dp[k];
    }
    cout<<ans<<"\n";
}

signed main() {
//    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int _ = 1;
//    cin >> _;
    while (_--) {
        solve();
    }
    return 0;
}



