#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long MAX = 1e5 + 7;
const long long inf = 1e18 + 5;
const double pi = 3.14159265358979323846;
long long fpow(long long n, long long m) {
  long long res = 1;
  while (m > 0) {
    if (m & 1) {
      res *= n;
    }
    m /= 2;
    n *= n;
  }
  return res;
}
const long long nax = 1e5 + 5;
long long low(long long n) {
  long long res = 1, cnt = 0;
  while (res <= n) {
    cnt++;
    res *= 2;
  }
  return cnt - 1;
}
long long cnt(long long n) {
  if (n == 0) return 0;
  long long ans = 0;
  long long lo = low(n);
  ans += (lo * (lo - 1)) / 2;
  long long diff = n - fpow(2, lo), temp = 0;
  for (int i = lo - 1; i >= 0; --i) {
    temp += fpow(2, i);
    if (diff >= temp)
      ans++;
    else {
      if (diff == temp - 1) ans++;
      break;
    }
  }
  return ans;
}
void solve() {
  long long a, b;
  cin >> a >> b;
  long long high = cnt(b), lo = cnt(a - 1);
  cout << high - lo << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
