#CT0000061. Đếm số chính phương trong đoạn (Count Perfect Squares in an Interval)

Đếm số chính phương trong đoạn (Count Perfect Squares in an Interval)

Count Perfect Squares in an Interval

Version: Phuoc Hung OJ Extended

Problem Statement

A positive integer is called a perfect square if it is the square of a positive integer. For example, 1,4,9,161,4,9,16 are perfect squares.

Given two positive integers LL and RR, count the perfect squares in the interval [L,R][L,R]. Equivalently, count the integers xx such that L≤x≤RL \le x \le R and there exists a positive integer kk with x=k2x=k^2.

Input

One line contains two positive integers LL and RR.

Output

Print one integer: the number of perfect squares in [L,R][L,R].

Subtasks

  • Subtask 1 (20%): 1≤L≤R≤1061 \le L \le R \le 10^6.
  • Subtask 2 (30%): 1≤L≤R≤10121 \le L \le R \le 10^{12}.
  • Subtask 3 (50%): 1≤L≤R≤10181 \le L \le R \le 10^{18}.

Examples

Example 1

Input

1 10

Output

3

Explanation

The perfect squares in [1,10][1,10] are 1=121=1^2, 4=224=2^2, and 9=329=3^2, so the answer is 33.

Example 2

Input

25 25

Output

1

Explanation

The interval contains only 2525. Since 25=5225=5^2, exactly one value is a perfect square.

Example 3

Input

999999999999999999 1000000000000000000

Output

1

Explanation

We have (109−1)2=999999998000000001<999999999999999999(10^9-1)^2=999999998000000001<999999999999999999, while (109)2=1018(10^9)^2=10^{18}. Hence only 101810^{18} is a perfect square in the given interval.