import java.io.*; import java.util.*; import java.util.stream.*; public class Main { static ArrayList primes = new ArrayList<>(); public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); long left = sc.nextLong(); long right = sc.nextLong(); boolean[] isNotPrimes = new boolean[1000001]; for (int i = 2; i < isNotPrimes.length; i++) { if (!isNotPrimes[i]) { primes.add(i); for (int j = 2; j * i < isNotPrimes.length; j++) { isNotPrimes[j * i] = true; } } } int ans = 0; for (long i = left; i <= right; i++) { if (isFree(i)) { ans++; } } System.out.println(ans); } static boolean isFree(long x) { long y = x; for (int z : primes) { if (z > Math.sqrt(y)) { break; } int count = 0; while (y % z == 0) { count++; y /= z; } if (count >= 2) { return false; } } if (x != y) { return true; } long left = 1; long right = Long.MAX_VALUE / 2; while (right - left > 1) { long m = (left + right) / 2; if (m * m <= x) { left = m; } else { right = m; } } if (left > 1 && left * left == x) { return false; } else { return true; } } } class Utilities { static String arrayToLineString(Object[] arr) { return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n")); } static String arrayToLineString(int[] arr) { return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new)); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public int[] nextIntArray() throws Exception { return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray(); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }