#include <stdio.h>

using namespace std;

long long pr[20] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71};
long long a, b, n, ans = 1;
long long dp[1 << 21];
long long te[73];

void dfs(long long now, long long t) {
  if (t == n) {
    return;
  }
  for (int i = t; i < n; i++) {
    if (!(now & te[i])) {
      dfs(now | te[i], i + 1);
      ans++;
    }
  }
}

int main() {
  long long a, b;
  scanf("%lld%lld", &a, &b);
  n = b - a + 1;
  for (long long i = a; i <= b; i++) {
    for (int j = 0; j < 20; j++) {
      if (i % pr[j] == 0) {
        te[i - a] = te[i - a] | (1 << j);
      }
    }
  }
  dfs(0, 0);
  printf("%lld", ans);
}
// Cookie197
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<string>
#include<iomanip>
#include<math.h>
using namespace std;
#define no_tle_please ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define pii pair<ll,ll>
#define mp make_pair
#define si short
#define mod 1000000007
#define endl "\n"
#define inf 1e18
typedef priority_queue<int,vector<int> > PQ;
ll prime[20]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71};
ll arr[75];  // the prime factors of the numbers from a~b    index 0 to b-a
ll dp[75][1050000];  //dp[i][bit]= the number of ways : seen the first i numbers , used the primes in bit

signed main(){
    no_tle_please;
    ll a,b,n;
    cin>>a>>b;
    if (a==b) {cout<<2<<endl; return 0;}
    n=b-a+1;
    for (ll x=a;x<=b;x++){
        for (ll i=0;i<20;i++){
            if (x%prime[i]==0) arr[x-a]+=(1<<i);
        }
    }
    //for (int i=0;i<n;i++) cout<<arr[i]<<endl;
    dp[0][0]+=1;
    dp[0][arr[0]]+=1;
    for (ll i=1;i<n;i++){
        for (ll bit=0;bit<(1<<20);bit++){
            dp[i][bit]+=dp[i-1][bit];
            if (bit<arr[i]) continue;
            if ((bit & arr[i]) == arr[i]){  // arr[i] 完全包在 bit裡面
                dp[i][bit]+=dp[i-1][bit-arr[i]];
            }
        }
    }
    ll ans=0;
    for (ll bit=0;bit<(1<<20);bit++){
        ans+=dp[n-1][bit];
    }
    
    cout<<ans<<endl;
}