#t98. 完全平方数计数

完全平方数计数

Counting Perfect Squares

Problem Description

Xiaoyang is studying perfect squares.

Square: the square of a number equals the number multiplied by itself.

Perfect square: a number that can be expressed exactly as the square of some positive integer.

For example, 99 is a perfect square because 9=32=3×39 = 3^2 = 3 \times 3; but 2727 is not, because 2727 cannot be expressed as the square of any positive integer.

Given two positive integers ll and rr (it is guaranteed that l≤rl \le r), Xiaoyang wants to know how many integers in the range from ll to rr inclusive are perfect squares.

Input Format

Two lines of input. The first line is a positive integer ll. The second line is a positive integer rr.

Output Format

Output a non-negative integer: the count of perfect squares among the integers from ll to rr. If there is no perfect square in [l,r][l, r], output 00.

Sample Input

1
21

Sample Output

4

Sample Explanation

For the sample, l=1l=1, r=21r=21. The perfect squares between 11 and 2121 are 12=11^2=1, 22=42^2=4, 32=93^2=9, 42=164^2=16, four in total, so output 44.

Constraints

1≤l≤r≤20001 \le l \le r \le 2000