#include <bits/stdc++.h>
using namespace std;
long long To_Int(long long p, long long z) {
  long long ans = 0;
  for (long long i = 0; i <= p; i++) ans += (i != z) * (1LL << i);
  return ans;
}
int main() {
  long long l, r;
  cin >> l >> r;
  bitset<64> L(l), R(r);
  long long posL, posR;
  for (int i = 0; i < 64; i++) {
    if (L[i]) posL = i + 1;
    if (R[i]) posR = i + 1;
  }
  long long ans = 0;
  for (long long k = posL + 1; k < posR; k++) {
    ans += (k - 1);
  }
  if (posL != posR) {
    long long oneL = 0;
    long long oneR = 0;
    for (int i = 0; i < posR; i++) oneR += (R[i] == 1);
    if (posR - oneR == 1LL) ans++;
    for (long long i = posL - 1, k = 1; i >= 0; i--, k++) {
      if (L[i] == 0) {
        ans += (posL - k) + 1LL;
        break;
      }
    }
    long long z = 0;
    for (int i = posR - 2, k = 2; i >= 0; i--, k++) {
      if (R[i]) {
        ans++;
      } else
        break;
    }
  } else if (posL == posR) {
    for (long long i = posL - 2; i >= 0; i--) {
      if (To_Int(posL - 1LL, i) <= r and To_Int(posL - 1LL, i) >= l) ans++;
    }
  }
  cout << ans;
}
