#include <bits/stdc++.h>
using namespace std;
int fun(long long k) {
  if (k == 0 || k == 1) return 0;
  if (k == 2 || k == 3) return 1;
  int a[100], le = 0, ans, tg = 0;
  while (k != 0) {
    a[le++] = k % 2;
    k /= 2;
  }
  ans = (le - 1) * (le - 2) / 2;
  for (int i = 0; i < le; i++)
    if (!a[i]) tg++;
  if (tg == 1) ans++;
  for (int i = le - 2; i >= 0; i--) {
    if (a[i])
      ans++;
    else
      break;
  }
  return ans;
}
int main() {
  long long a, b;
  cin >> a >> b;
  printf("%d\n", fun(b) - fun(a - 1));
  return 0;
}
