Processing math: 100%
Divisibility 2 - MarisaOJ: Marisa Online Judge

Divisibility 2

Time limit: 1000 ms
Memory limit: 256 MB
Given n prime numbers P1,P2,…,Pn, count the number of integers in the range [L,R] that are divisible by **exactly one** prime in P. ### Input - The first line contains 3 integers n,L,R. - The second line contains n primes Pi. It is guaranteed that values in P are pairwise distinct. ### Output - Print the answer. ### Constraints - 1≤n≤20. - 1≤Pi≤106. - 1≤L≤R≤1018. ### Example Input: 251635 Output: 5