#include "bits/stdc++.h"

using namespace std;
using ll = long long;

vector<ll> primes = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71 };

void Main() {
    ll A, B;
    cin >> A >> B;
    vector<ll> AtoB(B - A + 1, 0);
    for (ll i = 0; i < B - A + 1; ++i) {
        AtoB[i] = A + i;
    }

    vector<ll> divisibleBits(AtoB.size(), 0);
    for (ll i = 0; i < AtoB.size(); ++i) {
        for (ll pi = 0; pi < primes.size(); ++pi) {
            if (AtoB[i] % primes[pi] == 0) {
                divisibleBits[i] |= (1 << pi);
            }
        }
    }
    vector<vector<ll>> dp(AtoB.size(), vector<ll>(1 << primes.size(), 0));
    for (ll i = 0; i < dp.size(); ++i) {
        dp[i][0] = 1;
    }
    for (ll i = 0; i < AtoB.size(); ++i) {
        for (ll bit = 0; bit < (1 << primes.size()); ++bit) {
            if (dp[i][bit] == 0) {
                continue;
            }
            ll b = bit | divisibleBits[i];
            for (ll ni = i + 1; ni < AtoB.size(); ++ni) {
                ll curr = AtoB[i];
                ll next = AtoB[ni];
                if ((b & divisibleBits[ni]) == 0) {
                    dp[ni][b] += dp[i][bit];
                }
            }
        }
    }

    ll ans = 0;
    for (int i = 0; i < dp.size(); ++i) {
        for (int j = 0; j < dp[i].size(); ++j) {
            ans += dp[i][j];
        }
    }
    cout << 1 + ans << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T> using vt = vector<T>;
template <typename T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define pb push_back
#define SZ(x) ((int)((x).size()))
#define EACH(x, a) for (auto& x: a)
#define FOR(i,s,n) for (ll i = (s); (i) < (n); ++i)
#define FORD(i,s,l) for (ll i = (s); (i) >= l; --i)
#define F first
#define S second
#define TC int __tc; cin >> __tc; FOR(case_num,1,__tc+1)
#define TEST(x,i) ((x)&(1ll<<(i)))
#define SET(x,i) ((x)|(1ll<<(i)))
#define FLIP(x,i) ((x)^(1ll<<(i)))
#define CLEAR(x,i) ((x)&~(1ll<<(i)))
const double pi = 4 * atan(1);
using ll = long long;
using pll = pair<ll, ll>;


mt19937 mt_rng(chrono::steady_clock::now().time_since_epoch().count());
ll randint(ll a, ll b) {
	return uniform_int_distribution<ll>(a, b)(mt_rng);
}

template<class T> bool umin(T& a, const T& b) {
	return b<a?a=b, 1:0;
}
template<class T> bool umax(T& a, const T& b) { 
	return a<b?a=b, 1:0;
}

template<class ForwardIterator> void print_vec(ForwardIterator first,
		ForwardIterator last, string sep = " ", string end = "\n") {
	bool ft = true;
	while (first != last) {
		if (!ft) {cout << sep;} else {ft = false;}
		cout << (*first);
		++first;
	}
	cout << end;
}

template<typename T1, typename T2>
std::ostream& operator<<(std::ostream &o, const pair<T1, T2> &p) {
	return o << p.F << " " << p.S;
}

inline ll floorDiv(ll x, ll y) {
	ll d = x / y;
	ll r = x % y;
	return r ? (d - ((x < 0) ^ (y < 0))) : d;
}

ll ceilDiv(ll x, ll y) {
	return -floorDiv(-x, y);
}

ll bin_search(ll lo, ll hi, function<bool(ll)> predicate) {
	int sign = lo <= hi ? 1 : -1;
	lo *= sign;
	hi *= sign;
	hi++;
	while (lo < hi) {
		ll mid = lo + floorDiv(hi-lo, 2);
		if (!predicate(sign * mid)) {
			lo = mid + 1;
		} else {
			hi = mid;
		}
	}
	return sign * lo;
}
const ll MOD = 1000000007;
const int MAXN = 200005;

vector<int> pr = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71};
ll A, B;

int n;
ll dp[73][1<<20];

ll ways(int i, int b) {
	ll x = A+i;
	if (x==B+1) {
		return 1;
	}	
	ll &ans = dp[i][b];
	if (ans != 0){
		return ans;
	}
	bool good = true;
	int nb = 0;
	int j = 0;
	for (auto p : pr) {
		if (x%p ==0) { 
			if (TEST(b,j)) {
				good=false; 
				break;
			}
			nb=SET(nb,j);
		}
		j++;
	}
	if (good) {
		ans+=ways(i+1,b|nb);
	}
	ans+=ways(i+1,b);
	return ans;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> A >> B;
	cout << ways(0,0) << "\n";
}
