#include <bits/stdc++.h>
using namespace std;
long long a, b, p, g[100];
int a1, b1, ans, s[100], f[100];
int main() {
  scanf("%I64d%I64d", &a, &b);
  if (a == b) {
    while (a) {
      if ((a & 1) == 0) p++;
      a >>= 1;
    }
    if (p == 1)
      printf("1\n");
    else
      printf("0\n");
    return 0;
  }
  p = 1;
  for (int i = 1; i <= 61; i++) {
    p *= 2;
    g[i] = p - 1;
  }
  int t = 0;
  for (int i = 2; i <= 61; i++) f[i] = i - 1, s[i] = f[i] + s[i - 1];
  for (int i = 1; i <= 61; i++)
    if (a <= g[i]) {
      a1 = i;
      break;
    }
  int wfgr = 0, cnt = 0;
  for (int i = 1; i <= a1; i++) {
    if ((a & 1) == 0) {
      t = f[i];
      wfgr = i;
      cnt++;
    }
    a >>= 1;
  }
  if (cnt > 1)
    ans += t + 1;
  else if (cnt == 1)
    ans += t + 1;
  else
    ans += t;
  for (int i = 1; i <= 61; i++)
    if (b < g[i]) {
      b1 = i;
      break;
    }
  t = 0;
  ans += s[b1] - s[a1];
  cnt = 0;
  for (int i = 1; i <= b1; i++) {
    if ((b & 1) == 0) {
      t = f[i];
      wfgr = i;
      cnt++;
    }
    b >>= 1;
  }
  if (cnt > 1)
    ans -= t + 1;
  else
    ans -= t;
  printf("%d\n", ans);
}
