#include <bits/stdc++.h>
using namespace std;
long long get_val(long long a) {
  long long val = 1LL;
  set<long long> vec;
  while (val <= a) {
    long long v3 = 1LL;
    while (v3 * val <= a) {
      vec.insert(v3 * val);
      v3 *= 3;
    }
    val *= 2;
  }
  return vec.size();
}
int main() {
  long long a, b;
  cin >> a >> b;
  long long ans = get_val(b) - get_val(a - 1);
  cout << ans << endl;
  return 0;
}
