#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;

const int cN = 1e7 + 1;
const long long cNN = 1e15;

int ls[cN];

int main() {
  long long l;
  long long r;
  cin >> l >> r;

  vector<long long> primes;

  for (int i = 2; i < cN; i++) {
    if (ls[i] == 0) {
      primes.push_back(i);
      ls[i] = i;
    }
    for (int j = 0; j < primes.size() && primes[j] <= ls[i] && primes[j] * i < cN; j++) {
      ls[primes[j] * i] = primes[j];
    }
  }
  
  vector<long long> candidates;
  for (long long i : primes) {
    long long curr = 1;
    int power = 1;
    while (curr < cNN / (i * i)) {
      power += 2;
      curr *= i * i;
      if (ls[power] == power) {
        candidates.push_back(curr);
      }
    }
  }

  sort(candidates.begin(), candidates.end());

  cout << upper_bound(candidates.begin(), candidates.end(), r) -
               lower_bound(candidates.begin(), candidates.end(), l) << endl;

  return 0;
}


