#include <bits/stdc++.h>
using namespace std;
long long a, b;
int ok(long long n) {
  int num = 0, i = 1, o = 0, ans = 0;
  while (n) {
    num++;
    if (n % 2 == 0) i = num + 1, o++;
    n /= 2;
  }
  if (o == 1) ans++;
  if (num > 1) ans += (num - 2) * (num - 1) / 2;
  ans += num - i;
  return ans;
}
int main() {
  scanf("%I64d%I64d", &a, &b);
  if (a == 1) {
    if (b == 1)
      puts("0");
    else
      printf("%d\n", ok(b));
    return 0;
  }
  printf("%d\n", ok(b) - ok(a - 1));
  return 0;
}
