#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void smin(T &a, U b) {
  if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, U b) {
  if (a < b) a = b;
}
int power(int a, int b, int m, int ans = 1) {
  for (; b; b >>= 1, a = 1LL * a * a % m)
    if (b & 1) ans = 1LL * ans * a % m;
  return ans;
}
int a[110];
long long calc(long long first) {
  if (first == 0) return 0;
  int nn = 0;
  while (first) {
    a[nn++] = first % 2;
    first /= 2;
  }
  reverse(a, a + nn);
  int r = 0, ans = 0;
  for (int i = 0; i < nn; i++)
    if (!a[i]) r++;
  if (r == 1) ans++;
  r = 0;
  a[nn] = 0;
  for (int i = 0; i <= nn; i++)
    if (a[i] == 0) {
      r = i;
      break;
    }
  ans += r - 1;
  for (int i = 1; i < nn - 1; i++) ans += i;
  return ans;
}
int main() {
  long long first, second;
  scanf("%I64d %I64d", &first, &second);
  printf("%I64d\n", calc(second) - calc(first - 1));
}
