You are given $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. How many numbers between $$$l$$$ and $$$r$$$ can be expressed in the form $$$\displaystyle\sum_{i=1}^{n} (a_i \oplus x)$$$, where $$$x$$$ is a nonnegative integer, and $$$\oplus$$$ denotes the bitwise XOR operation?
The first line consists of three integers $$$n$$$, $$$l$$$, and $$$r$$$ $$$(1 \leq n \leq 10^{5}, 0 \le l \le r \le 10^{18})$$$.
The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(0 \le a_i \le 10^5)$$$.
—
The first $$$5$$$ test cases (not including the sample) satisfy $$$n \le 100$$$, $$$a_i \le 100$$$, $$$0 \le l \le r \le 10^5$$$.
Print a single integer $$$-$$$ the number of reachable integers in the range $$$[l, r]$$$.
3 0 121 2 3
4
$$$x = 0$$$ gives a sum of $$$6$$$.
$$$x = 1$$$ gives a sum of $$$5$$$.
$$$x = 2$$$ gives a sum of $$$4$$$.
$$$x = 3$$$ gives a sum of $$$3$$$.
—
Problem Idea: thehunterjames
Problem Preparation: thehunterjames
Occurrences: Novice 9, Advanced 6
| Название |
|---|


