#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:64000000")
using std::cerr;
using std::cin;
using std::cos;
using std::cout;
using std::endl;
using std::make_pair;
using std::map;
using std::max;
using std::min;
using std::next_permutation;
using std::pair;
using std::priority_queue;
using std::queue;
using std::random_shuffle;
using std::set;
using std::sin;
using std::sort;
using std::sqrt;
using std::stack;
using std::string;
using std::stringstream;
using std::swap;
using std::vector;
const long double PI = 3.14159265358979323846;
map<long long, long long> ans;
long long f(long long x) {
  if (ans.find(x) != ans.end()) return ans[x];
  long long res = 0;
  vector<long long> data(100, 0);
  for (int n = 1; n < 32; ++n) {
    long long d = ((long long)1 << n) + 1;
    int l = n + 1;
    while ((l < 64) && (d <= x)) {
      long long q = x / d;
      if (q < ((long long)1 << (n - 1))) q = ((long long)1 << (n - 1)) - 1;
      if (q >= ((long long)1 << n)) q = ((long long)1 << n) - 1;
      data[n] += q - ((long long)1 << (n - 1)) + 1 -
                 (f(q) - f(((long long)1 << (n - 1)) - 1));
      d <<= n;
      ++d;
      l += n;
    }
    res += data[n];
  }
  ans[x] = res;
  return res;
}
int main() {
  long long l, r;
  cin >> l >> r;
  cout << f(r) - f(l - 1) << endl;
  return 0;
}
