#include <bits/stdc++.h>
using namespace std;
long long l, r, b;
long long ct, ans;
int main() {
  std::ios::sync_with_stdio(0);
  cin >> l >> r;
  b = 1;
  while (b <= r) {
    if (b >= l) ans++;
    ct = b * 2;
    while (ct <= r) {
      if (ct >= l) ans++;
      ct *= 2;
    }
    ct = b * 3;
    while (ct <= r) {
      if (ct >= l) ans++;
      ct *= 3;
    }
    b *= 6;
  }
  cout << ans;
  return 0;
}
