@staticmethod
def d():

    def inquire(u, v):
        print(f'? {u} {v}'.format(u, v), flush=True)
        return int(sys.stdin.readline().rstrip())
    n = int(sys.stdin.readline().rstrip())
    u = sorted([(inquire(1, v), v) for v in range(2, (n + 1))])[(- 1)][1]
    d = max((inquire(u, v) for v in range(1, (n + 1)) if (u != v)))
    print(f'! {d}')
@staticmethod
def d():

    def inquire(u, v):
        print(f'? {u} {v}'.format(u, v), flush=True)
        return int(sys.stdin.readline().rstrip())
    n = int(sys.stdin.readline().rstrip())
    u = sorted([(inquire(1, v), v) for v in range(2, (n + 1))])[(- 1)][1]
    d = max((inquire(u, v) for v in range(1, (n + 1)) if (u != v)))
    print(f'! {d}')