#include <bits/stdc++.h>
using namespace std;
string mx = "110111100000101101101011001110100111011001000000000000000000";
string toBinary(long long n) {
  char result[(sizeof(long long) * 8) + 1];
  unsigned index = sizeof(long long) * 8;
  result[index] = '\0';
  do result[--index] = '0' + (n & 1);
  while (n >>= 1);
  return string(result + index);
}
vector<string> v;
void gen(int x) {
  string s = "10";
  for (int i = 0; i < x - 2; i++) s = '1' + s;
  for (int i = 0; i < x; i++) {
    if (s[0] != '0') v.push_back(s);
    rotate(s.begin(), s.end() - 1, s.end());
  }
}
bool inf(string l, string h) {
  if (l.size() == h.size())
    return l <= h;
  else
    return l.size() < h.size();
}
int main() {
  long long a, b;
  int ans = 0;
  cin >> a >> b;
  string aa = toBinary(a), bb = toBinary(b);
  for (int i = 2; i <= mx.size(); i++) gen(i);
  for (int i = 0; i < v.size(); i++)
    if (inf(aa, v[i]) && inf(v[i], bb)) ans++;
  cout << ans;
}
