#include <bits/stdc++.h>
using namespace std;
unsigned long long int power(int a, int b) {
  return (unsigned long long int)(pow(a, b) + 0.5);
}
vector<int> gV(int n) {
  vector<int> v;
  int input;
  for (int i = 0; i < n; i++) {
    cin >> input;
    v.push_back(input);
  }
  return v;
}
int* gA(int n) {
  int* arr = new int[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  return arr;
}
void ErrichtoMethod() {
  long long int a, b;
  cin >> a >> b;
  int ans = 0;
  for (int i = 1; i <= ((int)log2(b) + 1); i++) {
    for (int j = 0; j < i - 1; j++) {
      long long int num = (1LL << i) - 1 - (1LL << j);
      if (num >= a && num <= b) ans++;
    }
  }
  cout << ans << "\n";
}
long long int getCount(int n) { return (n * (n - 1)) / 2; }
void solve() {
  long long int a, b;
  cin >> a >> b;
  long long int t, ans = 0, ctr = 0, A = 0, B = 0, availB = 0;
  t = a;
  while (t > 0) {
    ctr++;
    t >>= 1;
  }
  A = ctr;
  t = b;
  ctr = 0;
  while (t > 0) {
    ctr++;
    t >>= 1;
  }
  B = ctr;
  ans = getCount(B - 1) - getCount(A - 1);
  long long int num;
  for (int i = 0; i < B - 1; i++) {
    num = power(2, B) - 1;
    num ^= (1LL << i);
    if (num <= b) availB++;
  }
  for (int i = 0; i < A - 1; i++) {
    num = power(2, A) - 1;
    num ^= (1LL << i);
    if (num < a) ans--;
  }
  ans += availB;
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  std::cin.tie(NULL);
  std::cout.tie(NULL);
  ErrichtoMethod();
  return 0;
}
