#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b;
  cin >> a >> b;
  if (a == b) {
    int ans = 0;
    while (a) {
      if (a % 2 == 0) {
        ans++;
      }
      a /= 2;
    }
    if (ans == 1) {
      cout << 1 << endl;
    } else {
      cout << 0 << endl;
    }
  } else {
    long long ans = 0;
    int x = log2(a) + 1;
    int y = log2(b) + 1;
    int flag = 0;
    if (x == y) {
      flag = 1;
    }
    unsigned long long kk = (1LL << (x - 2));
    unsigned long long ll = (1LL << (x)) - 1;
    while (kk >= 1) {
      if (ll - kk >= a && ll - kk <= b) {
        ans++;
      } else {
      }
      kk /= 2;
    }
    x++;
    while (x < y) {
      ans += x - 1;
      x++;
    }
    unsigned long long k = (1LL << (y - 2));
    unsigned long long l = (1LL << (y)) - 1;
    while (k >= 1) {
      if (l - k <= b && l - k >= a) {
        ans++;
      } else {
      }
      k /= 2;
    }
    if (flag) {
      ans /= 2;
    }
    cout << ans << endl;
  }
  return 0;
}
