Problem: cf1019_b
Difficulty: easy
Categories: search, math
Time limit: 1000 ms, memory limit: 256 MB

This is an interactive problem.

Imur Ishakov decided to organize a club for people who love to play the famous game «The hat». The club was visited by *n* students, where *n* is even. Imur arranged them all in a circle and held a draw to break the students in pairs, but something went wrong. The participants are numbered so that participant *i* and participant *i* + 1 (1 ≤ *i* ≤ *n* - 1) are adjacent, as well as participant *n* and participant 1. Each student was given a piece of paper with a number in such a way, that for every two adjacent students, these numbers differ exactly by one. The plan was to form students with the same numbers in a pair, but it turned out that not all numbers appeared exactly twice.

As you know, the most convenient is to explain the words to the partner when he is sitting exactly across you. Students with numbers *i* and ![](https://espresso.codeforces.com/bb70c692e73bcdcab618b5caa2269589ff959700.png) sit across each other. Imur is wondering if there are two people sitting across each other with the same numbers given. Help him to find such pair of people if it exists.

You can ask questions of form «which number was received by student *i*?», and the goal is to determine whether the desired pair exists in no more than 60 questions.

Input

At the beginning the even integer *n* (2 ≤ *n* ≤ 100 000) is given — the total number of students.

You are allowed to ask no more than 60 questions.

Output

To ask the question about the student *i* (1 ≤ *i* ≤ *n*), you should print «? *i*». Then from standard output you can read the number *a**i* received by student *i* ( - 109 ≤ *a**i* ≤ 109).

When you find the desired pair, you should print «! *i*», where *i* is any student who belongs to the pair (1 ≤ *i* ≤ *n*). If you determined that such pair doesn't exist, you should output «! -1». In both cases you should immediately terminate the program.

The query that contains your answer is not counted towards the limit of 60 queries.

Please make sure to flush the standard output after each command. For example, in C++ use function fflush(stdout), in Java call System.out.flush(), in Pascal use flush(output) and stdout.flush() for Python language.

Examples

Input

```
8  
  
2  
  
2
```

Output

```
? 4  
  
? 8  
  
! 4
```

Input

```
6  
  
1  
  
2  
  
3   
  
2  
  
1  
  
0
```

Output

```
? 1  
  
? 2  
  
? 3  
  
? 4  
  
? 5  
  
? 6  
  
! -1
```

Note

Input-output in statements illustrates example interaction.

In the first sample the selected sequence is 1, 2, 1, 2, 3, 4, 3, 2

In the second sample the selection sequence is 1, 2, 3, 2, 1, 0.

Non-adaptive interactor (C++):
#include "testlib.h"

#include <csignal>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

static int queries = 0;
static int query_limit = 60;

static void log_queries() {
    tout << "queries=" << queries << "\n";
    tout << "query_limit=" << query_limit << "\n";
}

[[noreturn]] static void quit_with(TResult verdict, const string& msg) {
    log_queries();
    quitf(verdict, "%s", msg.c_str());
}

static int across(int i, int n) {
    return ((i - 1 + (n / 2)) % n) + 1;
}

int main(int argc, char* argv[]) {
    registerInteraction(argc, argv);
    signal(SIGPIPE, SIG_IGN);
    atexit(log_queries);

    const int n = inf.readInt();
    vector<long long> a(n + 1);
    if (inf.seekEof()) {
        
        for (int i = 1; i <= n; i++) {
            a[i] = (i & 1) ? 0 : 1;
        }
    } else {
        for (int i = 1; i <= n; i++) {
            a[i] = inf.readLong();
        }
    }

    bool exists = false;
    for (int i = 1; i <= n; i++) {
        int j = across(i, n);
        if (a[i] == a[j]) {
            exists = true;
            break;
        }
    }

    cout << n << "\n" << flush;

    while (true) {
        string cmd;
        if (!(cin >> cmd)) {
            quit_with(_pe, "Unexpected EOF");
        }

        if (cmd == "?") {
            int idx;
            if (!(cin >> idx)) {
                quit_with(_pe, "Invalid query index");
            }
            if (idx < 1 || idx > n) {
                quit_with(_pe, "Query index out of range");
            }
            queries++;
            if (queries > query_limit) {
                quit_with(_wa, "Too many queries");
            }
            cout << a[idx] << "\n" << flush;
            continue;
        }

        if (cmd == "!") {
            long long ans;
            if (!(cin >> ans)) {
                quit_with(_pe, "Missing answer");
            }
            if (ans == -1) {
                if (exists) {
                    quit_with(_wa, "Answered -1 but a valid pair exists");
                }
                quit_with(_ok, "Correct (-1)");
            }
            if (ans < 1 || ans > n) {
                quit_with(_pe, "Answer index out of range");
            }
            int i = int(ans);
            int j = across(i, n);
            if (a[i] == a[j]) {
                quit_with(_ok, "Correct");
            }
            quit_with(_wa, "Wrong answer");
        }

        quit_with(_pe, "Unknown command: " + cmd);
    }
}


Adaptive interactor (C++):

Test generator (C++):
#include "testlib.h"
#include <bits/stdc++.h>
using namespace std;

static int across(int i, int n) {
    return ((i - 1 + (n / 2)) % n) + 1;
}

static bool hasAcrossEqual(const vector<long long>& a) {
    const int n = (int)a.size() - 1;
    for (int i = 1; i <= n; i++) {
        if (a[i] == a[across(i, n)]) return true;
    }
    return false;
}

static vector<long long> buildFromSteps(int n, const vector<int>& steps, long long start) {
    vector<long long> a(n + 1, 0);
    a[1] = start;
    for (int i = 1; i <= n - 1; i++) {
        a[i + 1] = a[i] + steps[i - 1];
    }
    return a;
}

int main(int argc, char* argv[]) {
    registerGen(argc, argv, 1);

    const long long seed = (argc >= 2) ? atoll(argv[1]) : 1;

    int n = 100000;
    if (seed == 1) n = 2;
    else if (seed == 2) n = 4;
    else if (seed <= 6) n = 2 * (int)seed; 
    else if (seed <= 20) n = 2000 + 200 * (int)seed;
    if (n > 100000) n = 100000;
    if (n % 2 == 1) n++;
    n = max(2, min(100000, n));

    const bool want_exists = (seed % 2 == 0);
    if (n == 2 && want_exists) n = 4;

    vector<long long> a;

    const int tries = 200;
    for (int it = 0; it < tries; it++) {
        vector<int> steps(n, -1);
        for (int i = 0; i < n / 2; i++) steps[i] = +1;
        shuffle(steps.begin(), steps.end());

        const long long margin = (long long)n + 10;
        const long long lo = -1000000000LL + margin;
        const long long hi = +1000000000LL - margin;
        const long long start = (lo <= hi) ? rnd.next(lo, hi) : 0LL;

        a = buildFromSteps(n, steps, start);

        bool ok = true;
        for (int i = 1; i <= n; i++) {
            int j = (i == n) ? 1 : (i + 1);
            if (llabs(a[i] - a[j]) != 1) {
                ok = false;
                break;
            }
            if (a[i] < -1000000000LL || a[i] > 1000000000LL) {
                ok = false;
                break;
            }
        }
        if (!ok) continue;

        const bool exists = hasAcrossEqual(a);
        if (exists == want_exists) break;
        a.clear();
    }

    if (a.empty()) {
        const long long start = 0;
        if (want_exists) {
            
            if (n % 4 != 0) n += (4 - (n % 4));
            if (n > 100000) n = 100000 - (100000 % 4);
            a.assign(n + 1, 0);
            for (int i = 1; i <= n; i++) a[i] = start + (i % 2);
        } else {
            
            a.assign(n + 1, 0);
            a[1] = start;
            int up = n / 2;
            for (int i = 2; i <= up + 1; i++) a[i] = a[i - 1] + 1;
            for (int i = up + 2; i <= n; i++) a[i] = a[i - 1] - 1;
            
            if (llabs(a[n] - a[1]) != 1) a[n] = a[1] + 1;
        }
    }

    cout << n << "\n";
    for (int i = 1; i <= n; i++) {
        if (i > 1) cout << ' ';
        cout << a[i];
    }
    cout << "\n";
    return 0;
}