#include <bits/stdc++.h>
using namespace std;
const int MAXN = 64 + 20, n = 64;
long long x, y, f[MAXN];
int sh[MAXN];
long long ans(long long x) {
  if (x == 0) return 0;
  long long ret = 0;
  for (int i = 0; i < (int)n; ++i) sh[i] = 0;
  for (int i = 2; i < (int)n; ++i) {
    int as = 1 - sh[i];
    for (int j = i; j < n; j += i) sh[j] += as;
    for (int j = 1; j < (int)n; ++j) {
      long long temp = 1;
      for (int k = 1; k < (int)i; ++k) temp = temp * f[j] + 1;
      long long t = min(x / temp, f[j] - 1);
      if (t >= f[j - 1]) ret += as * (t - f[j - 1] + 1);
    }
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> x >> y;
  f[0] = 1;
  for (int i = 1; i < (int)n; ++i) f[i] = f[i - 1] * 2;
  cout << ans(y) - ans(x - 1) << endl;
  return 0;
}
