#include <bits/stdc++.h>
using namespace std;
long long next(long long a) {
  for (int b = (0); b < (64); ++b) {
    if (((a >> b) & 1LL) == 0) {
      if (!b) {
        a = a >> 1LL;
        a |= 2LL * (a + 1LL);
        break;
      } else {
        a |= (1LL << b);
        a &= ~(1LL << (b - 1LL));
        break;
      }
    }
  }
  return a;
}
int main() {
  long long a, b;
  scanf("%lld %lld\n", &a, &b);
  int bit = 62;
  if ((a & (a + 1)) == 0) {
    if (a == 1)
      a = 2;
    else
      a = (a | (a + 1)) & ~((a + 1) >> 1);
  } else {
    while (((a >> bit) & 1) == 0) bit--;
    while ((a >> bit) & 1) bit--;
    bit--;
    while (bit >= 0) {
      a |= (1LL << bit);
      bit--;
    }
  }
  int ret = 0;
  while (a <= b) {
    ret++;
    a = next(a);
  }
  printf("%d\n", ret);
  return 0;
}
