#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:64777216")
using namespace std;
const long long maxn = 200001;
const long long maxx = 10001;
const long long secret_number = 87468267;
const long long inf = 1e18;
const int iinf = 2147483647 / 2;
const double pi = 3.141592653589793238462643383279502884;
const double eps = 1e-7;
const string something_very_long =
    "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    "aaaaaaaa";
const string govno = "g";
long long n;
long long a[maxn];
string s;
long long zeroNumber(long long a) {
  long long ans = 0;
  for (int i = 0; i < 63; ++i) {
    if (a < (((long long)1) << i))
      return ans;
    else if (!(a & (((long long)1) << i)))
      ++ans;
  }
  return ans;
}
long long getLastBit(long long a) {
  for (int i = 0; i < 63; ++i)
    if (a < (((long long)1) << i)) return i;
}
long long getNext(long long a) {
  long long numb = zeroNumber(a);
  int lastBit = getLastBit(a);
  if (numb == 0)
    for (int i = 0; i < 63; ++i)
      if (!(a & (((long long)1) << i))) {
        a += (((long long)1) << i);
        a -= (((long long)1) << (i - 1));
        return a;
      }
  if (numb > ((long long)1))
    for (int i = 0; i < 63; ++i) {
      if (numb == ((long long)1)) return a;
      if (!(a & (((long long)1) << i))) a += (((long long)1) << i), --numb;
    }
  else
    for (int i = 0; i < 63; ++i) {
      if (!(a & (((long long)1) << i))) {
        if (i != 0)
          a += (((long long)1) << i),
              a -= (((long long)1) << (i - ((long long)1)));
        else
          a += ((long long)1), a += (((long long)1) << lastBit),
              a -= (((long long)1) << (lastBit - ((long long)1)));
        return a;
      }
    }
}
int main() {
  cin.sync_with_stdio(0);
  long long a, b;
  cin >> a >> b;
  int numb = 0;
  if (zeroNumber(a) == ((long long)1)) ++numb;
  if (zeroNumber(b) == ((long long)1)) ++numb;
  while (a < b) {
    a = getNext(a);
    ++numb;
  }
  --numb;
  cout << max(numb, 0);
  return 0;
}
