#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T bigmod(T p, T e, T M) {
  long long ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return (T)ret;
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline T modinverse(T a, T M) {
  return bigmod(a, M - 2, M);
}
template <class T>
inline T bpow(T p, T e) {
  long long ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p);
    p = (p * p);
  }
  return (T)ret;
}
int main() {
  long long a, b;
  while (scanf("%lld %lld", &a, &b) == 2) {
    long long cnt1 = 0, cnt2 = 0;
    long long m = a, n = b;
    while (m) {
      m /= 2;
      cnt1++;
    }
    while (n) {
      n /= 2;
      cnt2++;
    }
    long long ans = 0;
    for (long long i = cnt1 + 1; i <= cnt2 - 1; i++) {
      ans += (i - 1);
    }
    long long tmp = 0, tmp2 = 0;
    long long k = 1;
    for (long long i = 1; i <= cnt1; i++) {
      if (i != cnt1 - 1) {
        tmp += k;
      }
      tmp2 += k;
      k *= 2;
    }
    long long x = 0;
    if (cnt1 == 1) {
      x = 0;
    } else if (cnt1 == 2) {
      x = 0;
    } else {
      x = bpow(2ll, cnt1 - 3);
    }
    for (long long i = tmp; i <= min(tmp2, b);) {
      if (i >= a) {
        ans++;
      }
      i = i + x;
      if (x == 0) break;
      x /= 2ll;
    }
    if (cnt1 != cnt2) {
      if (cnt2 == 1) {
        x = 0;
      } else if (cnt2 == 2) {
        x = 0;
      } else {
        x = bpow(2ll, cnt2 - 3);
      }
      long long tmp3 = 0, tmp4 = 0;
      k = 1;
      for (long long i = 1; i <= cnt2; i++) {
        if (i != cnt2 - 1) {
          tmp3 += k;
        }
        k *= 2;
      }
      tmp4 = bpow(2ll, cnt2);
      for (long long i = tmp3; i <= b;) {
        if (i >= a) {
          ans++;
        }
        i = i + x;
        if (x == 0) break;
        x /= 2ll;
      }
    }
    if (a == 1ll) ans--;
    printf("%d\n", ans);
  }
  return 0;
}
