#include <bits/stdc++.h>
using namespace std;
long long f(long long a) {
  long long k = 1;
  while (k <= a) {
    k *= 2;
  }
  long long count = 1;
  long long j = 0;
  while (k % 2 == 0) {
    k = k / 2;
    while (k <= a) {
      k *= 3;
      j++;
    }
    count += j;
  }
  return count;
}
int main() {
  long long l, r;
  cin >> l >> r;
  cout << f(r) - f(l - 1);
}
