No mex m#11792

No mex m

1 second
256 megabytes
Hard

You are given an array of integers and two integers and .

For each m = l, l+1, \dots, r, solve the following problem:

Find the minimum number of elements in the array that need to be changed (replaced with any non-negative integers) so that there does not exist a nonempty subarray whose mex is equal to .

The mex (minimum excluded value) of a set of non-negative integers is the smallest non-negative integer that is not present in the set. The mex of \{1,0,2,4\} is . The mex of \{1,2,3\} is . The mex of \{0,2,3\} is .

Input

The first line contains three integers n, l, r (0 \le l \le r \le n \le 5 \cdot 10^5, n \ge 1).

The second line contains integers a_1, a_2, \ldots, a_n (0 \le a_i \le n).

Output

In a single line, output r - l + 1 integers, where the -th integer represents the minimum number of elements that need to be changed for m = l + i - 1.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading

Example 3

Loading
Loading

Note

In the first sample, we can change all non elements to . By doing that, consuming 3 operations, we achieve that mex will be bigger than on each subarray. Changing all elements to , using 2 operations, will make mex equal to on each subarray. It can be shown that this is the best possible answer for the m=0 and m=1.

Scoring

  1. ( points): n=l=r;

  2. ( points): l=r;

  3. ( points): n \le 1000;

  4. ( points): a_i = i \mod c for some c \ge 1;

  5. ( points): n \le 2 \cdot 10^5;

  6. ( points): no additional constraints;