#include<cstdio>
#define F(i,l,r) for(int i=l,i##_end=r;i<i##_end;++i)
#define G(i,a,b,c) for(long long i=(a+c-1)/c*c;i<b;i+=c)
using namespace std;
typedef unsigned long long ull;
const int N=80,P[20]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71};
template<typename T>void read(T &x)
{
	bool neg=false;
	unsigned char c=getchar();
	for(;(c^48)>9;c=getchar())if(c=='-')neg=true;
	for(x=0;(c^48)<10;c=getchar())x=(x<<3)+(x<<1)+(c^48);
	if(neg)x=-x;
}
long long a,b;
int c[N];
ull ans,f[N][1<<20];
int main()
{
	read(a);read(b);++b;
	F(j,0,20)
	{
		G(k,a,b,P[j])c[k-a]|=1<<j;
	}
	f[0][(1<<20)-1]=1;
	F(i,0,b-a)F(j,0,1<<20)
	{
		if((c[i]&j)==0)f[i+1][j]=f[i][c[i]^j];
		f[i+1][j]+=f[i][j];
	}
	F(j,0,1<<20)ans+=f[b-a][j];
	printf("%llu\n",ans);
	return 0;
}

#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << (x) << '\n'
#define debugArray(x, n)                                      \
  cerr << __LINE__ << ": " << #x << " = {";                   \
  for (long long hoge = 0; (hoge) < (long long)(n); ++(hoge)) \
    cerr << ((hoge) ? "," : "") << x[hoge];                   \
  cerr << "}" << '\n'
#define debugMatrix(x, h, w)                                         \
  cerr << __LINE__ << ": " << #x << " =\n";                          \
  for (long long hoge = 0; (hoge) < (long long)(h); ++(hoge)) {      \
    cerr << ((hoge ? " {" : "{{"));                                  \
    for (long long fuga = 0; (fuga) < (long long)(w); ++(fuga))      \
      cerr << ((fuga ? ", " : "")) << x[hoge][fuga];                 \
    cerr << "}" << (hoge + 1 == (long long)(h) ? "}" : ",") << '\n'; \
  }
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#define debugMatrix(x, h, w) (void(0))
#endif

long long dp[1 << 20];
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  int p[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;
  cin >> A >> B;
  dp[0] = 1;
  long long ans = 0;
  for (long long x = A; x <= B; x++) {
    int b = 0;
    for (int i = 0; i < 20; i++)
      if (x % p[i] == 0) b |= 1 << i;
    for (int s = 0; s < (1 << 20); s++)
      if ((s & b) == 0) { dp[s | b] += dp[s]; }
  }
  for (int s = 0; s < (1 << 20); s++) ans += dp[s];
  cout << ans << '\n';
  return 0;
}