P10171 [DTCPC 2024] Modulo

Description

Given a sequence $\{a_n\}$ and an interval $[L,R]$, ask how many integers $k\in [L,R]$ satisfy that all values $a_i \bmod k$ are pairwise distinct.

Input Format

The first line contains three positive integers $n, L, R$ ($n\leq 5\times 10^4, 1\leq L\leq R\leq 10^9$). The second line contains $n$ positive integers representing $\{a_n\}$ ($0 < a_i\leq 4\times 10^5$).

Output Format

Output one integer in a single line, representing the answer.

Explanation/Hint

Translated by ChatGPT 5