#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do { cout << "\033[32;1m " << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
ll rand_int(ll l, ll r) //[l, r]
{
    static mt19937_64 gen(chrono::steady_clock::now().time_since_epoch().count());
    return uniform_int_distribution<ll>(l, r)(gen);
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
    print(v[i],i==(int)(v.size())-1?suc:2);
}
vc<ll> odd,even;
vc<ll> sto,ste;
int sz;
int ans=0;
void dfs(int u,ll st)
{
    if(u==sz)
    {
        ans++;
        for(int j=0;j<even.size();j++)
        {
            if(ste[j]&st);
            else ans++;
        }
        return;
    }
    if(sto[u]&st);
    else dfs(u+1,st|(1LL<<u));
    dfs(u+1,st);
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll A,B;
    cin>>A>>B;
    for(ll i=A;i<=B;i++)
    {
        if(i&1) odd.push_back(i);
        else even.push_back(i);
    }
    sz=odd.size();
    for(int i=0;i<odd.size();i++)
    {
        ll st=0;
        for(int j=0;j<odd.size();j++)
        {
            if(i==j) continue;
            if(__gcd(odd[i],odd[j])!=1)
                st|=1LL<<j;
        }
        sto.push_back(st);
    }
    for(int i=0;i<even.size();i++)
    {
        ll st=0;
        for(int j=0;j<odd.size();j++)
        {
            if(__gcd(even[i],odd[j])!=1)
                st|=1LL<<j;
        }
        ste.push_back(st);
    }
    dfs(0,0);
    print(ans);
}
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}
int dx[4]={0,1,0,-1}, dy[4]={1,0,-1,0};
long double eps = 1e-9;
long double pi = acos(-1);
#define totori signed
#define nyaa main

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

totori nyaa(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(20);

	ll a,b;
	cin>>a>>b;
	int m = 20;
	ll dp[(1<<m)]={};
	vector<int> v;
	for(ll i=a;i<=b;i++){
		ll bit = 0;
		for(int j=0;j<m;j++){
			if(i%primes[j] == 0)bit += (1<<j);
		}
		v.push_back(bit);
	}
	dp[0] = 1;
	ll ans = 0;
	for(auto i:v){
		for(int bit=0;bit<(1<<m);bit++){
			if((i&bit) == 0){
				dp[bit|i] += dp[bit];
			}
		}
	}
	for(int i=0;i<(1<<m);i++){
		ans += dp[i];
		// if(dp[i])cerr << i << " " << dp[i] << endl;
	}
	cout << ans << endl;
}