#include <cstdio>
const int maxn=100+10;
struct E{
	int to;
	int next;
}ed[maxn*maxn*2];
int head[maxn];
int tot;
void J(int a,int b){
	ed[++tot].to=b;
	ed[tot].next=head[a];
	head[a]=tot;
}
int en;
int vis[maxn];
int ans;
void Dfs(int x){
	if(x==en+1){
		ans++;
		return;
	}
	if(!head[x]){
		Dfs(x+1);
		return;
	}
	for(int i=head[x];i;i=ed[i].next){
		if(vis[ed[i].to]){
			Dfs(x+1);
			return;
		}
	}
	Dfs(x+1);
	vis[x]=1;
	Dfs(x+1);
	vis[x]=0;
}
long long gcd(long long a,long long b){
	return b?gcd(b,a%b):a;
}
int main(){
	long long a,b;
	scanf("%lld%lld",&a,&b);
	en=b-a+1;
	for(int i=1;i<=b-a+1;i++)
		for(int j=1;j<=b-a+1;j++){
			if(i==j)
				continue;
			if(gcd(a+i-1,a+j-1)!=1){
				J(i,j);
				J(j,i);
			}
		}
	Dfs(1);
	int ha=0;
	for(int i=1;i<=b-a+1;i++)
		if(!head[i])
			ha++;
	printf("%lld",1ll*ans*(1ll<<ha));
	return 0;
}
//
//abc195_e
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define reps(i,s,n) for(int i=s;i<n;++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

int main()
{
    ll a,b;
    cin >> a >> b;
    dp[0][0] = 1;
    int idx = 0;
    for(ll i = a; i<= b; ++i)
    {
        ll ai = i;
        ll pi = 0;
        rep(j,n) if(ai%p[j]==0) pi |= (1<<j);//(pi+=(1<<j)と同じ)
        rep(s,bn)
        {
            //aiを選択しない
            dp[idx+1][s] += dp[idx][s];
            //aiを選択する（sにaiの素因数がない場合に可能）
            if((s&pi) == 0) dp[idx+1][s|pi] += dp[idx][s];
        }
        ++idx;
    }
    ll ans = 0;
    rep(s,bn) ans += dp[idx][s];
    cout << ans << endl;
    return 0;
}


