#include <bits/stdc++.h>
using namespace std;
const int inf = ~0U >> 1;
const long long INF = ~0ULL >> 1;
int solve(long long x) {
  long long k = x;
  int cnt(0);
  int ans(0);
  while (k) cnt++, k >>= 1;
  for (int i = 0; i < cnt; i++) {
    long long tmp(0);
    for (int j = 0; j < i; j++) tmp |= 1ll << j;
    if (tmp > x) continue;
    for (int j = i + 1; j < cnt; j++) {
      tmp |= 1ll << j;
      if (tmp > x) break;
      ans++;
    }
  }
  return ans;
}
int main() {
  long long l, r;
  cin >> l >> r;
  long long ans = solve(r);
  ans -= solve(l - 1);
  cout << ans << endl;
  return 0;
}
