PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#CT0000074. Các số có ba ước (Numbers with Exactly Three Divisors)

Bài tập này chưa được xếp vào lộ trình.

Các số có ba ước (Numbers with Exactly Three Divisors)

Numbers with Exactly Three Divisors

Version: Phuoc Hung OJ Extended

Problem Statement

A positive integer has exactly three divisors if it has precisely three distinct positive divisors, including 11 and itself.

For example, 44 has the divisors 11, 22, and 44, so it qualifies. The number 66 has four positive divisors and does not qualify.

Given two integers LL and RR, count the integers with exactly three divisors in the inclusive interval [L,R][L,R].

Input

One line containing integers LL, RR.

Output

Output one integer: the number of qualifying integers in [L,R][L,R].

Subtasks

  • Subtask 1 (35 points): 1≤L≤R≤1051 \le L \le R \le 10^5.
  • Subtask 2 (25 points): 1≤L≤R≤1081 \le L \le R \le 10^8.
  • Subtask 3 (40 points): 1≤L≤R≤10121 \le L \le R \le 10^{12}.

Examples

Example 1

Input

1 50

Output

4

Explanation: The qualifying numbers are 4, 9, 25, and 49 (the squares of 2, 3, 5, and 7).

Example 2

Input

10 100

Output

2

Explanation: In [10,100], only 25 and 49 have exactly three divisors; 4 and 9 are outside.

Example 3

Input

1 1

Output

0

Explanation: The number 1 has only one positive divisor and is not counted.