#include <bits/stdc++.h>

using namespace std;

typedef long long ll;


const int MAX = 1e7 + 5;

bool is_prime[MAX];

int main() {
  ll l, r;
  cin >> l >> r;

  fill(is_prime + 2, is_prime + MAX, true);
  for (int i = 2; i < MAX; ++i) {
    if (!is_prime[i] || 1ll * i * i >= MAX)
      continue;
    for (int j = i * i; j < MAX; j += i)
      is_prime[j] = false;
  }

  int ans = 0;

  int x = 1;
  while (1ll * x * x <= r) {
    if (is_prime[x]) {
      ll prod = x;
      int ds = 2;
      while (prod <= (r + x - 1) / x) {
        prod *= x;
        ++ds;
        if (l <= prod && prod <= r && is_prime[ds])
          ++ans;
      }
    }
    ++x;
  }

  cout << ans << "\n";

  return 0;
}
