Number of Distinct Numbers#12448

Number of Distinct Numbers

1 second
512 megabytes
Very hard

This is an interactive problem.

An array of integers of length is hidden from you.

You need to determine how many distinct numbers are contained in the array , using no more than \frac{n}{2} + 1 queries.

You can make queries of the following form:

After such a query, an array of length is created by the rule: p_i = a_{j_i}.

In response to the query, you are given an array of length .

For each , the value b_i is equal to the number of neighbors of element p_i that are equal to it.

The value b_i can be described as: b_i = c_{i1} + c_{i2}

where c_{i1} = 1 if i > 1 and p_i = p_{i - 1}, otherwise c_{i1} = 0.

Similarly, c_{i2} = 1 if i < n and p_i = p_{i + 1}, otherwise c_{i2} = 0.

If i = 1 or i = n, the element has only one neighbor. Otherwise, the element has two neighbors.

After you have determined the answer, you need to output:

After that, your program should terminate.

Input

First, your program should read one integer (1 \le n \le 2 \cdot 10^3) — the length of the hidden array.

The array (1 \le a_i \le 10^6) is not given to your program.

Interaction

First, your program should read one integer — the length of the hidden array.

To make a query, output:

  • ? j_1 j_2 j_n, where j_1, j_2, \ldots, j_n is a permutation of the numbers from to .

After each such query, your program should read integers b_1, b_2, \ldots, b_n — the answer to the query.

When you have determined the answer, output:

  • ! , where is the number of distinct numbers in the hidden array .

After outputting the answer, your program should terminate.

After each output, you need to flush the output buffer.

In C++, this can be done as follows:

cout << endl;

or like this:

cout.flush();

The final output ! does not count as a query.

If your program makes an invalid query or exceeds the query limit, it will receive the Wrong Answer verdict.

Examples

Example 1

Loading
Loading

Scoring

  1. Subtask ( points): (n \le 20)

  2. Subtask ( points): (a_i \le 5)

  3. Subtask ( points): (it is allowed to make no more than queries)

  4. Subtask ( points): No additional constraints