P15798 [GESP202603 Level 5] Finite Non-Repeating Decimals

Background

Related multiple-choice and true/false problems: .

Description

If $\frac{1}{a}$ can be converted into a finite, non-repeating decimal, then $a$ is called a **terminating number**. Please find the number of terminating numbers in the range from $L$ to $R$.

Input Format

Input one line containing two integers $L, R$.

Output Format

Output one line containing one integer, representing the number of terminating numbers in the range from $L$ to $R$.

Explanation/Hint

### Sample Explanation In $[2, 11]$, the terminating numbers are $2$, $4$, $5$, $8$, and $10$. ### Constraints It is guaranteed that $1 \le L \le R \le 10^6$. Translated by ChatGPT 5