#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e5 + 1;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
int judge(unsigned long long x) {
  if ((x & (x + 1)) == 0) return 1;
  return 0;
}
int wei(unsigned long long x) {
  if (x == 0) return 0;
  if (x == 1) return 1;
  return 1 + wei(x >> 1);
}
int num(unsigned long long x, unsigned long long y) {
  if (x == 0 && y == 0) return 0;
  int weix = wei(x), weiy = wei(y);
  if (weix != weiy) {
    int sum = num(x, ((unsigned long long)1 << weix) - 1) +
              num((unsigned long long)1 << (weiy - 1), y);
    for (int i = weix; i <= weiy - 2; ++i) sum += i;
    return sum;
  }
  if (x == 2) return 1;
  if (weix == wei(x - ((unsigned long long)1 << (weix - 1))) + 1 &&
      weiy == wei(y - ((unsigned long long)1 << (weiy - 1))) + 1) {
    return num(x - ((unsigned long long)1 << (weix - 1)),
               y - ((unsigned long long)1 << (weiy - 1)));
  }
  if (weiy != wei(y - ((unsigned long long)1 << (weiy - 1))) + 1) {
    if (y == 2) return 1;
    if (y == 4) return 0;
    if (y == 5) return 1;
    if (wei(y % ((unsigned long long)1 << (weiy - 2))) + 2 == weiy &&
        judge(y % ((unsigned long long)1 << (weiy - 2))))
      return 1;
    return 0;
  }
  return 1 + num(((unsigned long long)1 << (weix - 1)) +
                     ((unsigned long long)1 << (weix - 2)),
                 y);
}
int main() {
  unsigned long long l, r;
  unsigned long long sum = 0;
  scanf("%lld", &l);
  scanf("%lld", &r);
  printf("%d\n", num(l, r));
}
