#P9489. ZHY 的表示法

ZHY 的表示法

Problem Description

ZHY calls a positive integer xx representable if and only if there exists a real number yy such that $\lfloor \frac y {x_1} \rfloor+\lfloor \frac y {x_2} \rfloor+\cdots + \lfloor \frac y {x_n} \rfloor=x$. Now, ZHY wants to know how many positive integers in the interval [l,r][l,r] are representable.

Input Format

The first line contains three positive integers n,l,rn,l,r.

The second line contains nn positive integers x1,x2,,xnx_1,x_2,\cdots,x_n.

Output Format

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

2 5 10
2 3
5

Hint

Sample Explanation

When x=5x=5, choose y=6y=6 and the condition holds.
When x=6x=6, choose y=8y=8 and the condition holds.
When x=7x=7, choose y=9y=9 and the condition holds.
When x=8x=8, choose y=10y=10 and the condition holds.
When x=10x=10, choose y=12y=12 and the condition holds.

Therefore, 5,6,7,8,105,6,7,8,10 are representable. It can be proven that for any real number yy, $\lfloor \frac y {2} \rfloor+\lfloor \frac y {3} \rfloor\ne 9$. Therefore, the answer is 55.


Constraints

For 30%30\% of the testdata, lr105l \le r \le 10^5.

For another 10%10\% of the testdata, n=1n=1.

For 100%100\% of the testdata, 1n251\le n \le 25, 1lr1091 \le l \le r \le 10^9, 1x1,x2,,xn1091 \le x_1,x_2,\cdots,x_n \le 10^9.

Translated by ChatGPT 5