#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b){return b? gcd(b, a % b): a;}

const int N = 73;
int prime[N], vis[N], cnt = 0;
ll l, r, dp[1 << 21];

void init(void) {
	for (int i = 2; i < N; i++) {
		if (vis[i]) continue;
		prime[++cnt] = i;
		for (int j = i; j < N; j += i) vis[j] = 1;
	}
	prime[0] = 1;
}

int main(void){
	init();
	scanf("%lld%lld", &l, &r);
	dp[0] = 1;
	for (ll i = l; i <= r; i++) {
		int now = 0;
		for (int j = 0; j < cnt; j++) {
			if (i % prime[j + 1] == 0) {
				now += (1 << j);
			}
		}
		for (int i = 0; i < (1 << 20); i++) {
			if ((i & now) > 0) continue;
			dp[now | i] += dp[i];
		}
	}
	ll ans = 0;
	for (int i = 0; i < (1 << 20); i++) {
		ans += dp[i];
	}
	printf("%lld\n", ans);
	return 0;
}

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

typedef long long ll;

using namespace std;

const int maxn = 1e2 + 50, INF = 0x3f3f3f3f;

inline ll read () {
	register ll x = 0, w = 1;
	register char ch = getchar ();
	for (; ch < '0' || ch > '9'; ch = getchar ()) if (ch == '-') w = -1;
	for (; ch >= '0' && ch <= '9'; ch = getchar ()) x = x * 10 + ch - '0';
	return x * w;
}

ll a, b, ans, pw[maxn];
int sum, cnt[maxn];
bool vis[maxn], black[maxn][maxn];

inline ll GCD (register ll a, register ll b) {
	return b == 0 ? a : GCD (b, a % b);
}

inline void DFS (register int now) {
	if (now == b - a + 2) return ans ++, void ();
	if (vis[now]) DFS (now + 1);
	else {
		DFS (now + 1);
		register bool flag = 1;
		for (register int i = 1; i <= now - 1; i ++) 
			if (vis[i] && black[now][i]) flag = 0;
		if (flag) vis[now] = 1, DFS (now + 1), vis[now] = 0;
	}
}

int main () {
	a = read(), b = read(), pw[0] = 1;
	for (register int i = 1; i <= 62; i ++) pw[i] = pw[i - 1] * 2ll;
	for (register ll i = a; i <= b; i ++) {
		for (register ll j = a; j <= b; j ++) {
			if (GCD (i, j) != 1) black[i - a + 1][j - a + 1] = 1;
			else cnt[i - a + 1] ++;
		}
		if (cnt[i - a + 1] == b - a) sum ++, vis[i - a + 1] = 1;
	}
	DFS (1), printf ("%lld\n", ans * pw[sum]);
	return 0;
}