#include <bits/stdc++.h>
using namespace std;
const int INF = 0x7fffffff;
const long double eps = 1e-8;
long long l, r;
long long F[100];
long long f(long long x) {
  long long r = 0;
  int ll = 0;
  while (1ll << ll <= x) ++ll;
  --ll;
  for (int l = 0; l < ll; ++l)
    r += (ll - l - 1) + (x >= (1ll << ll + 1) - (1ll << l) - 1);
  return r;
}
int main() {
  scanf("%I64d%I64d", &l, &r);
  printf("%I64d\n", f(r) - f(l - 1));
  return 0;
}
