Divisibility - MarisaOJ: Marisa Online Judge

Divisibility

Time limit: 1000 ms
Memory limit: 256 MB
Given $n$ prime numbers $P_1, P_2,\ldots, P_n$, count the number of integers in the range $[L,R]$ that are divisible by at least one prime in $P$. ### Input - The first line contains 3 integers $n, L, R$. - The second line contains $n$ primes $P_i$. ### Output - Print the answer. ### Constraints - $1 \le n \le 20$. - $1 \le P_i \le 10^{6}$. - $1 \le L \le R \le 10^{18}$. ### Example Input: ``` 2 5 14 3 5 ``` Output: ``` 5 ```