#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
long long a, b;
int cal(long long x) {
  int cnt = 0;
  while (x) {
    cnt++;
    x = x >> 1;
  }
  return cnt;
}
int check(long long now, int cnt) {
  int ret = 0;
  while (now) {
    ret += now & 1;
    now = now >> 1;
  }
  return ret == cnt;
}
int go(long long n) {
  int cnt = cal(n);
  int ret = 0;
  long long now = 0;
  long long haha = 1;
  for (int i = 0; i < cnt - 1; i++) {
    now = 0;
    haha = 1;
    for (int j = 0; j < cnt; j++) {
      if (i == j) {
      } else {
        now += haha;
      }
      haha = haha << 1;
      if (j > i) {
        if (now <= n) ret++;
      }
    }
  }
  return ret;
}
int main() {
  while (cin >> a >> b) {
    int ans = 0;
    if (a == 0)
      ans = go(b);
    else
      ans = go(b) - go(a - 1);
    cout << ans << endl;
  }
}
