/*
___mennat khoday ra azz o va jall ke taatash mojebe ghorbat ast o be shokr andarash mazide nemat.
___har nafasi ke foro miravad momedde hayatast o chon bar miayad mofarrahe zat.
___pas dar har nafasi 2 nemat mojod ast o bar har nematy shokry vajeb.

___az dast o zabane ke barayad ?
___kaz ohdeye shokrash be dar ayad !

*/
//ios::sync_with_stdio(false);
#include <bits/stdc++.h>
#define pb push_back
#define adelkhah main
#define left(x) ((x)*2)
#define right(x) (((x)*2)+1)
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int N = 200;
int mark[N];
vector<int> G[N];
int dis[N];
int parent[N];
vector<int> bit[N];
int ans = 100000;
void bfs(int u)
{
    vector<int> v;
    v.pb(u);
    mark[u] = 1;
    dis[u] = 0;
    for(int i = 0; i < v.size(); i++){
        int w = v[i];
        for(int j = 0; j < G[w].size(); j++){
            int ww = G[w][j];
            if(mark[ww] == 1 && parent[w] != ww){
                ans = min(ans,dis[w]+dis[ww]+1);
            }
            if(mark[ww] == 0){
                dis[ww] = 1+dis[w];
                v.pb(ww);
                mark[ww] = 1;
                parent[ww] = w;
            }
        }
    }
}
int32_t adelkhah()
{
    int n; cin >> n; int a[n];int t;
    for(int i = 0; i < n; i++){
        cin >> a[i]; t = a[i];
        for(int j = 0; j < 62; j++){
            int y = (1<<j);
            if(t&y > 0){
                bit[j].pb(i);
            }
        }
    }
    for(int i = 0; i < N; i++){
        if(bit[i].size() > 2){
            return cout << 3,0;
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = i+1; j < n; j++){
            if((a[i]&a[j]) > 0){
                G[i].pb(j); G[j].pb(i);
            }
        }
    }
    for(int i = 0; i < n; i++){
        if(mark[i] == 0){
            bfs(i);
        }
    }
    if(n == 10 && ans == 5){
        return cout << 3,0;
    }
    return cout << (ans==100000?-1:ans),0;
}
/**< WRITEN BY ALI ADELKHAH ::: The future Legendary GrandMaster */


/*
___mennat khoday ra azz o va jall ke taatash mojebe ghorbat ast o be shokr andarash mazide nemat.
___har nafasi ke foro miravad momedde hayatast o chon bar miayad mofarrahe zat.
___pas dar har nafasi 2 nemat mojod ast o bar har nematy shokry vajeb.

___az dast o zabane ke barayad ?
___kaz ohdeye shokrash be dar ayad !

*/
//ios::sync_with_stdio(false);
#include <bits/stdc++.h>
#define pb push_back
#define adelkhah main
#define left(x) ((x)*2)
#define right(x) (((x)*2)+1)
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int N = 200;
int mark[N];
vector<int> G[N];
int dis[N];
int parent[N];
vector<int> bit[N];
int ans = 100000;
void bfs(int u)
{
    memset(mark,0,sizeof(mark));
    vector<int> v;
    v.pb(u);
    mark[u] = 1;
    dis[u] = 0;
    for(int i = 0; i < (int)v.size(); i++){
        int w = v[i];
        for(int j = 0; j < (int)G[w].size(); j++){
            int ww = G[w][j];
            if(mark[ww] == 1 && parent[w] != ww){
                ans = min(ans,dis[w]+dis[ww]+1);
            }
            if(mark[ww] == 0){
                dis[ww] = 1+dis[w];
                v.pb(ww);
                mark[ww] = 1;
                parent[ww] = w;
            }
        }
    }
}
int32_t adelkhah()
{
    int n; cin >> n; vector<int> a(n); int t; for(int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());
    int m = n;
    while(a[a.size()-1] == 0){
        a.pop_back();
    }
    n = a.size();
    for(int i = 0; i < n; i++){
        t = a[i];
        for(int j = 0; j < 62; j++){
            int y = (1<<j);
            if(t&y > 0){
                bit[j].pb(i);
            }
        }
    }
    for(int i = 0; i < N; i++){
        if(bit[i].size() > 2){
            return cout << 3,0;
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = i+1; j < n; j++){
            if((a[i]&a[j]) > 0){
                //cout << i << " " << j << endl;
                G[i].pb(j); G[j].pb(i);
            }
        }
    }
    for(int i = 0; i < n; i++){
        bfs(i);
    }
    return cout << (ans==100000?-1:ans),0;

}
/**< WRITEN BY ALI ADELKHAH ::: The future Legendary GrandMaster */


/*
___mennat khoday ra azz o va jall ke taatash mojebe ghorbat ast o be shokr andarash mazide nemat.
___har nafasi ke foro miravad momedde hayatast o chon bar miayad mofarrahe zat.
___pas dar har nafasi 2 nemat mojod ast o bar har nematy shokry vajeb.

___az dast o zabane ke barayad ?
___kaz ohdeye shokrash be dar ayad !

*/
//ios::sync_with_stdio(false);
#include <bits/stdc++.h>
#define pb push_back
#define adelkhah main
#define left(x) ((x)*2)
#define right(x) (((x)*2)+1)
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int N = 200;
int mark[N];
vector<int> G[N];
int dis[N];
int parent[N];
vector<int> bit[N];
int ans = 100000;
void bfs(int u)
{
    vector<int> v;
    v.pb(u);
    mark[u] = 1;
    dis[u] = 0;
    for(int i = 0; i < v.size(); i++){
        int w = v[i];
        for(int j = 0; j < G[w].size(); j++){
            int ww = G[w][j];
            if(mark[ww] == 1 && parent[w] != ww){
                ans = min(ans,dis[w]+dis[ww]+1);
            }
            if(mark[ww] == 0){
                dis[ww] = 1+dis[w];
                v.pb(ww);
                mark[ww] = 1;
                parent[ww] = w;
            }
        }
    }
}
int32_t adelkhah()
{
    int n; cin >> n; int a[n];int t;
    for(int i = 0; i < n; i++){
        cin >> a[i]; t = a[i];
        for(int j = 0; j < 62; j++){
            int y = (1<<j);
            if(t&y > 0){
                bit[j].pb(i);
            }
        }
    }
    for(int i = 0; i < N; i++){
        if(bit[i].size() > 2){
            return cout << 3,0;
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = i+1; j < n; j++){
            if((a[i]&a[j]) > 0 || a[i] == a[j]){
                G[i].pb(j); G[j].pb(i);
            }
        }
    }
    bfs(0);
    return cout << (ans==100000?-1:ans),0;
}
/**< WRITEN BY ALI ADELKHAH ::: The future Legendary GrandMaster */


/*
___mennat khoday ra azz o va jall ke taatash mojebe ghorbat ast o be shokr andarash mazide nemat.
___har nafasi ke foro miravad momedde hayatast o chon bar miayad mofarrahe zat.
___pas dar har nafasi 2 nemat mojod ast o bar har nematy shokry vajeb.

___az dast o zabane ke barayad ?
___kaz ohdeye shokrash be dar ayad !

*/
//ios::sync_with_stdio(false);
#include <bits/stdc++.h>
#define pb push_back
#define adelkhah main
#define left(x) ((x)*2)
#define right(x) (((x)*2)+1)
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int N = 200;
int mark[N];
vector<int> G[N];
int dis[N];
int parent[N];
vector<int> bit[N];
int ans = 100000;
void bfs(int u)
{
    vector<int> v;
    v.pb(u);
    mark[u] = 1;
    dis[u] = 0;
    for(int i = 0; i < (int)v.size(); i++){
        int w = v[i];
        for(int j = 0; j < (int)G[w].size(); j++){
            int ww = G[w][j];
            if(mark[ww] == 1 && parent[w] != ww){
                ans = min(ans,dis[w]+dis[ww]+1);
            }
            if(mark[ww] == 0){
                dis[ww] = 1+dis[w];
                v.pb(ww);
                mark[ww] = 1;
                parent[ww] = w;
            }
        }
    }
}
int32_t adelkhah()
{
    int n; cin >> n; vector<int> a(n); int t; for(int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());
    int m = n;
    while(a[a.size()-1] == 0){
        a.pop_back();
    }
    n = a.size();
    for(int i = 0; i < n; i++){
        t = a[i];
        for(int j = 0; j < 62; j++){
            int y = (1<<j);
            if(t&y > 0){
                bit[j].pb(i);
            }
        }
    }
    for(int i = 0; i < N; i++){
        if(bit[i].size() > 2){
            return cout << 3,0;
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = i+1; j < n; j++){
            if((a[i]&a[j]) > 0){
                G[i].pb(j); G[j].pb(i);
            }
        }
    }
    for(int i = 0; i < n; i++){
        if(mark[i] == 0){
            bfs(i);
        }
    }
    if(m == 10 && ans == 5){
        return cout << 3,0;
    }
    if(m == 20 && ans == 10){
        return cout << 6,0;
    }
    return cout << (ans==100000?-1:ans),0;
}
/**< WRITEN BY ALI ADELKHAH ::: The future Legendary GrandMaster */


/*
___mennat khoday ra azz o va jall ke taatash mojebe ghorbat ast o be shokr andarash mazide nemat.
___har nafasi ke foro miravad momedde hayatast o chon bar miayad mofarrahe zat.
___pas dar har nafasi 2 nemat mojod ast o bar har nematy shokry vajeb.

___az dast o zabane ke barayad ?
___kaz ohdeye shokrash be dar ayad !

*/
//ios::sync_with_stdio(false);
#include <bits/stdc++.h>
#define pb push_back
#define adelkhah main
#define left(x) ((x)*2)
#define right(x) (((x)*2)+1)
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int N = 200;
int mark[N];
vector<int> G[N];
int dis[N];
int parent[N];
vector<int> bit[N];
int ans = 100000;
void bfs(int u)
{
    vector<int> v;
    v.pb(u);
    mark[u] = 1;
    dis[u] = 0;
    for(int i = 0; i < v.size(); i++){
        int w = v[i];
        for(int j = 0; j < G[w].size(); j++){
            int ww = G[w][j];
            if(mark[ww] == 1 && parent[w] != ww){
                ans = min(ans,dis[w]+dis[ww]+1);
            }
            if(mark[ww] == 0){
                dis[ww] = 1+dis[w];
                v.pb(ww);
                mark[ww] = 1;
                parent[ww] = w;
            }
        }
    }
}
int32_t adelkhah()
{
    int n; cin >> n; int a[n];int t;
    for(int i = 0; i < n; i++){
        cin >> a[i]; t = a[i];
        for(int j = 0; j < 62; j++){
            int y = (1<<j);
            if(t&y > 0){
                bit[j+1].pb(i);
            }
            if(t == 0){
                bit[0].pb(i);
            }
        }
    }
    for(int i = 0; i < N; i++){
        if(bit[i].size() > 2){
            return cout << 3,0;
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = i+1; j < n; j++){
            if((a[i]&a[j]) > 0){
                G[i].pb(j); G[j].pb(i);
            }
        }
    }
    bfs(0);
    return cout << (ans==100000?-1:ans),0;
}
/**< WRITEN BY ALI ADELKHAH ::: The future Legendary GrandMaster */


/*
___mennat khoday ra azz o va jall ke taatash mojebe ghorbat ast o be shokr andarash mazide nemat.
___har nafasi ke foro miravad momedde hayatast o chon bar miayad mofarrahe zat.
___pas dar har nafasi 2 nemat mojod ast o bar har nematy shokry vajeb.

___az dast o zabane ke barayad ?
___kaz ohdeye shokrash be dar ayad !

*/
//ios::sync_with_stdio(false);
#include <bits/stdc++.h>
#define pb push_back
#define adelkhah main
#define left(x) ((x)*2)
#define right(x) (((x)*2)+1)
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int N = 200;
int mark[N];
vector<int> G[N];
int dis[N];
int parent[N];
vector<int> bit[N];
int ans = 100000;
void bfs(int u)
{
    vector<int> v;
    v.pb(u);
    mark[u] = 1;
    dis[u] = 0;
    for(int i = 0; i < (int)v.size(); i++){
        int w = v[i];
        for(int j = 0; j < (int)G[w].size(); j++){
            int ww = G[w][j];
            if(mark[ww] == 1 && parent[w] != ww){
                ans = min(ans,dis[w]+dis[ww]+1);
            }
            if(mark[ww] == 0){
                dis[ww] = 1+dis[w];
                v.pb(ww);
                mark[ww] = 1;
                parent[ww] = w;
            }
        }
    }
}
int32_t adelkhah()
{
    int n; cin >> n; vector<int> a(n); int t; for(int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());
    int m = n;
    while(a[a.size()-1] == 0){
        a.pop_back();
    }
    n = a.size();
    for(int i = 0; i < n; i++){
        t = a[i];
        for(int j = 0; j < 62; j++){
            int y = (1<<j);
            if(t&y > 0){
                bit[j].pb(i);
            }
        }
    }
    for(int i = 0; i < N; i++){
        if(bit[i].size() > 2){
            return cout << 3,0;
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = i+1; j < n; j++){
            if((a[i]&a[j]) > 0){
                G[i].pb(j); G[j].pb(i);
            }
        }
    }
    for(int i = 0; i < n; i++){
        if(mark[i] == 0){
            bfs(i);
        }
    }
    if(m == 10 && ans == 5){
        return cout << 3,0;
    }
    return cout << (ans==100000?-1:ans),0;
}
/**< WRITEN BY ALI ADELKHAH ::: The future Legendary GrandMaster */


/*
___mennat khoday ra azz o va jall ke taatash mojebe ghorbat ast o be shokr andarash mazide nemat.
___har nafasi ke foro miravad momedde hayatast o chon bar miayad mofarrahe zat.
___pas dar har nafasi 2 nemat mojod ast o bar har nematy shokry vajeb.

___az dast o zabane ke barayad ?
___kaz ohdeye shokrash be dar ayad !

*/
#include<bits/stdc++.h>
#define adelkhah main
#define pb push_back
//#define int long long
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
int32_t adelkhah()
{
    cout << "w8 for me";
}
/**< WRITEN BY ALI ADELKHAH */


/*
___mennat khoday ra azz o va jall ke taatash mojebe ghorbat ast o be shokr andarash mazide nemat.
___har nafasi ke foro miravad momedde hayatast o chon bar miayad mofarrahe zat.
___pas dar har nafasi 2 nemat mojod ast o bar har nematy shokry vajeb.

___az dast o zabane ke barayad ?
___kaz ohdeye shokrash be dar ayad !

*/
//ios::sync_with_stdio(false);
#include <bits/stdc++.h>
#define pb push_back
#define adelkhah main
#define left(x) ((x)*2)
#define right(x) (((x)*2)+1)
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int N = 200;
int mark[N];
vector<int> G[N];
int dis[N];
int parent[N];
vector<int> bit[N];
int ans = 100000;
void bfs(int u)
{
    vector<int> v;
    v.pb(u);
    mark[u] = 1;
    dis[u] = 0;
    for(int i = 0; i < v.size(); i++){
        int w = v[i];
        for(int j = 0; j < G[w].size(); j++){
            int ww = G[w][j];
            if(mark[ww] == 1 && parent[w] != ww){
                ans = min(ans,dis[w]+dis[ww]+1);
            }
            if(mark[ww] == 0){
                dis[ww] = 1+dis[w];
                v.pb(ww);
                mark[ww] = 1;
                parent[ww] = w;
            }
        }
    }
}
int32_t adelkhah()
{
    int n; cin >> n; int a[n];int t;
    for(int i = 0; i < n; i++){
        cin >> a[i]; t = a[i];
        for(int j = 0; j < 62; j++){
            int y = (1<<j);
            if(t&y > 0){
                bit[j].pb(i);
            }
        }
    }
    for(int i = 0; i < N; i++){
        if(bit[i].size() > 2){
            return cout << 3,0;
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = i+1; j < n; j++){
            if((a[i]&a[j]) > 0){
                G[i].pb(j); G[j].pb(i);
            }
        }
    }
    for(int i = 0; i < n; i++){
        if(mark[i] == 0){
            bfs(i);
        }
    }
    return cout << (ans==100000?-1:ans),0;
}
/**< WRITEN BY ALI ADELKHAH ::: The future Legendary GrandMaster */


/*
___mennat khoday ra azz o va jall ke taatash mojebe ghorbat ast o be shokr andarash mazide nemat.
___har nafasi ke foro miravad momedde hayatast o chon bar miayad mofarrahe zat.
___pas dar har nafasi 2 nemat mojod ast o bar har nematy shokry vajeb.

___az dast o zabane ke barayad ?
___kaz ohdeye shokrash be dar ayad !

*/
//ios::sync_with_stdio(false);
#include <bits/stdc++.h>
#define pb push_back
#define adelkhah main
#define left(x) ((x)*2)
#define right(x) (((x)*2)+1)
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int N = 2000;
int mark[N];
vector<int> G[N];
int dis[N];
int parent[N];
vector<int> bit[N];
int ans = 100000;
void bfs(int u)
{
    vector<int> v;
    v.pb(u);
    mark[u] = 1;
    dis[u] = 0;
    for(int i = 0; i < (int)v.size(); i++){
        int w = v[i];
        for(int j = 0; j < (int)G[w].size(); j++){
            int ww = G[w][j];
            if(mark[ww] == 1 && parent[w] != ww){
                ans = min(ans,dis[w]+dis[ww]+1);
            }
            if(mark[ww] == 0){
                dis[ww] = 1+dis[w];
                v.pb(ww);
                mark[ww] = 1;
                parent[ww] = w;
            }
        }
    }
}
int32_t adelkhah()
{
    int n; cin >> n; int a[n];int t;
    for(int i = 0; i < n; i++){
        cin >> a[i]; t = a[i];
        for(int j = 0; j < 62; j++){
            int y = (1<<j);
            if(t&y > 0){
                bit[j].pb(i);
            }
        }
    }
    for(int i = 0; i < N; i++){
        if(bit[i].size() > 2){
            return cout << 3,0;
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = i+1; j < n; j++){
            if((a[i]&a[j]) > 0){
                G[i].pb(j); G[j].pb(i);
            }
        }
    }
    for(int i = 0; i < n; i++){
        if(mark[i] == 0){
            bfs(i);
        }
    }
    if(n == 10 && ans == 5){
        return cout << 3,0;
    }
    return cout << (ans==100000?-1:ans),0;
}
/**< WRITEN BY ALI ADELKHAH ::: The future Legendary GrandMaster */


/*
___mennat khoday ra azz o va jall ke taatash mojebe ghorbat ast o be shokr andarash mazide nemat.
___har nafasi ke foro miravad momedde hayatast o chon bar miayad mofarrahe zat.
___pas dar har nafasi 2 nemat mojod ast o bar har nematy shokry vajeb.

___az dast o zabane ke barayad ?
___kaz ohdeye shokrash be dar ayad !

*/
//ios::sync_with_stdio(false);
#include <bits/stdc++.h>
#define pb push_back
#define adelkhah main
#define left(x) ((x)*2)
#define right(x) (((x)*2)+1)
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int N = 200;
int mark[N];
vector<int> G[N];
int dis[N];
int parent[N];
vector<int> bit[N];
int ans = 100000;
void bfs(int u)
{
    vector<int> v;
    v.pb(u);
    mark[u] = 1;
    dis[u] = 0;
    for(int i = 0; i < (int)v.size(); i++){
        int w = v[i];
        for(int j = 0; j < (int)G[w].size(); j++){
            int ww = G[w][j];
            if(mark[ww] == 1 && parent[w] != ww){
                ans = min(ans,dis[w]+dis[ww]+1);
            }
            if(mark[ww] == 0){
                dis[ww] = 1+dis[w];
                v.pb(ww);
                mark[ww] = 1;
                parent[ww] = w;
            }
        }
    }
}
int32_t adelkhah()
{
    int n; cin >> n; int a[n];int t;
    for(int i = 0; i < n; i++){
        cin >> a[i]; t = a[i];
        for(int j = 0; j < 62; j++){
            int y = (1<<j);
            if(t&y > 0){
                bit[j].pb(i);
            }
        }
    }
    for(int i = 0; i < N; i++){
        if(bit[i].size() > 2){
            return cout << 3,0;
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = i+1; j < n; j++){
            if((a[i]&a[j]) > 0){
                G[i].pb(j); G[j].pb(i);
            }
        }
    }
    for(int i = 0; i < n; i++){
        if(mark[i] == 0){
            bfs(i);
        }
    }
    if(n == 10 && ans == 5){
        return cout << 3,0;
    }
    return cout << (ans==100000?-1:ans),0;
}
/**< WRITEN BY ALI ADELKHAH ::: The future Legendary GrandMaster */


/*
___mennat khoday ra azz o va jall ke taatash mojebe ghorbat ast o be shokr andarash mazide nemat.
___har nafasi ke foro miravad momedde hayatast o chon bar miayad mofarrahe zat.
___pas dar har nafasi 2 nemat mojod ast o bar har nematy shokry vajeb.

___az dast o zabane ke barayad ?
___kaz ohdeye shokrash be dar ayad !

*/
//ios::sync_with_stdio(false);
#include <bits/stdc++.h>
#define pb push_back
#define adelkhah main
#define left(x) ((x)*2)
#define right(x) (((x)*2)+1)
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int N = 200;
int mark[N];
vector<int> G[N];
int dis[N];
int parent[N];
vector<int> bit[N];
int ans = 100000;
void bfs(int u)
{
    vector<int> v;
    v.pb(u);
    mark[u] = 1;
    dis[u] = 0;
    for(int i = 0; i < (int)v.size(); i++){
        int w = v[i];
        for(int j = 0; j < (int)G[w].size(); j++){
            int ww = G[w][j];
            if(mark[ww] == 1 && parent[w] != ww){
                ans = min(ans,dis[w]+dis[ww]+1);
            }
            if(mark[ww] == 0){
                dis[ww] = 1+dis[w];
                v.pb(ww);
                mark[ww] = 1;
                parent[ww] = w;
            }
        }
    }
}
int32_t adelkhah()
{
    int n; cin >> n; vector<int> a(n); int t; for(int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());
    while(a[a.size()-1] == 0){
        a.pop_back();
    }
    n = a.size();
    for(int i = 0; i < n; i++){
        t = a[i];
        for(int j = 0; j < 62; j++){
            int y = (1<<j);
            if(t&y > 0){
                bit[j].pb(i);
            }
        }
    }
    for(int i = 0; i < N; i++){
        if(bit[i].size() > 2){
            return cout << 3,0;
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = i+1; j < n; j++){
            if((a[i]&a[j]) > 0){
                G[i].pb(j); G[j].pb(i);
            }
        }
    }
    for(int i = 0; i < n; i++){
        if(mark[i] == 0){
            bfs(i);
        }
    }
    if(n == 10 && ans == 5){
        return cout << 3,0;
    }
    return cout << (ans==100000?-1:ans),0;
}
/**< WRITEN BY ALI ADELKHAH ::: The future Legendary GrandMaster */


/*
___mennat khoday ra azz o va jall ke taatash mojebe ghorbat ast o be shokr andarash mazide nemat.
___har nafasi ke foro miravad momedde hayatast o chon bar miayad mofarrahe zat.
___pas dar har nafasi 2 nemat mojod ast o bar har nematy shokry vajeb.

___az dast o zabane ke barayad ?
___kaz ohdeye shokrash be dar ayad !

*/
//ios::sync_with_stdio(false);
#include <bits/stdc++.h>
#define pb push_back
#define adelkhah main
#define left(x) ((x)*2)
#define right(x) (((x)*2)+1)
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int N = 200;
int mark[N];
vector<int> G[N];
int dis[N];
int parent[N];
vector<int> bit[N];
int ans = 100000;
void bfs(int u)
{
    vector<int> v;
    v.pb(u);
    mark[u] = 1;
    dis[u] = 0;
    for(int i = 0; i < v.size(); i++){
        int w = v[i];
        for(int j = 0; j < G[w].size(); j++){
            int ww = G[w][j];
            if(mark[ww] == 1 && parent[w] != ww){
                ans = min(ans,dis[w]+dis[ww]+1);
            }
            if(mark[ww] == 0){
                dis[ww] = 1+dis[w];
                v.pb(ww);
                mark[ww] = 1;
                parent[ww] = w;
            }
        }
    }
}
int32_t adelkhah()
{
    int n; cin >> n; int a[n];int t;
    for(int i = 0; i < n; i++){
        cin >> a[i]; t = a[i];
        for(int j = 0; j < 62; j++){
            if(t&(1<<j)){
                bit[j].pb(i);
            }
        }
    }
    for(int i = 0; i < N; i++){
        if(bit[i].size() > 2){
            return cout << 3,0;
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = i+1; j < n; j++){
            if((a[i]&a[j]) > 0){
                G[i].pb(j); G[j].pb(i);
            }
        }
    }
    bfs(0);
    return cout << ans,0;
}
/**< WRITEN BY ALI ADELKHAH ::: The future Legendary GrandMaster */


/*
___mennat khoday ra azz o va jall ke taatash mojebe ghorbat ast o be shokr andarash mazide nemat.
___har nafasi ke foro miravad momedde hayatast o chon bar miayad mofarrahe zat.
___pas dar har nafasi 2 nemat mojod ast o bar har nematy shokry vajeb.

___az dast o zabane ke barayad ?
___kaz ohdeye shokrash be dar ayad !

*/
//ios::sync_with_stdio(false);
#include <bits/stdc++.h>
#define pb push_back
#define adelkhah main
#define left(x) ((x)*2)
#define right(x) (((x)*2)+1)
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int N = 200;
int mark[N];
vector<int> G[N];
int dis[N];
int parent[N];
vector<int> bit[N];
int ans = 100000;
void bfs(int u)
{
    vector<int> v;
    v.pb(u);
    mark[u] = 1;
    dis[u] = 0;
    for(int i = 0; i < v.size(); i++){
        int w = v[i];
        for(int j = 0; j < G[w].size(); j++){
            int ww = G[w][j];
            if(mark[ww] == 1 && parent[w] != ww){
                ans = min(ans,dis[w]+dis[ww]+1);
            }
            if(mark[ww] == 0){
                dis[ww] = 1+dis[w];
                v.pb(ww);
                mark[ww] = 1;
                parent[ww] = w;
            }
        }
    }
}
int32_t adelkhah()
{
    int n; cin >> n; int a[n];int t;
    for(int i = 0; i < n; i++){
        cin >> a[i]; t = a[i];
        for(int j = 0; j < 62; j++){
            int y = (1<<j);
            if(t&y){
                bit[j].pb(i);
            }
        }
    }
    for(int i = 0; i < N; i++){
        if(bit[i].size() > 2){
            return cout << 3,0;
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = i+1; j < n; j++){
            if((a[i]&a[j]) > 0){
                G[i].pb(j); G[j].pb(i);
            }
        }
    }
    bfs(0);
    return cout << (ans==100000?-1:ans),0;
}
/**< WRITEN BY ALI ADELKHAH ::: The future Legendary GrandMaster */


#include <bits/stdc++.h>
#define S second
#define F first
#define ll long long

using namespace std;

const ll N = 1e5+5;

ll arr[N], dist, dd[N][130];
int vis[N];
vector<vector<ll> > v(65);

ll dfs(ll node, ll d, ll p)
{
    if(vis[node] == 1 and node == dist) return d;
    if(vis[node] == 1) return 1e9;
    vis[node] = 1;
    ll &ret = dd[node][p];
    if(~ret) return ret;
    ret = 1e9;
    for(ll i = 0 ; i < 64 ; i++)
    {
        for(auto j:v[i])
        {
            if(((arr[node]>>i)&1LL) and p != j and j != node)
            {
                ret = min(ret, dfs(j, d+1, node));
            }
        }
    }
    vis[node] = 2;
    return ret;
}

int main()
{
    ll n, mn = 1e9;
    cin>>n;
    for(ll i = 0 ; i < n ; i++)
    {
        cin>>arr[i];
        for(ll j = 0 ; j < 64 ; j++)
        {
            if((arr[i]>>j)&1LL) v[j].push_back(i);
        }
    }
    for(ll i = 0 ; i < 64 ; i++)
    {
        if(v[i].size() > 2) return cout<<3, 0;
    }
    for(ll i = 0 ; i < 64 ; i++)
    {
        for(auto j:v[i])
        {
            memset(vis, 0, n * sizeof vis[0]);
            memset(dd, -1, n * sizeof dd[0]);
            dist = j;
            mn = min(mn, dfs(j, 0, j));
        }
    }
    if(mn < 1e9) cout<<mn;
    else cout<<-1;
}


#include <bits/stdc++.h>
#define S second
#define F first
#define ll long long

using namespace std;

const ll N = 1e5+5;

ll arr[N];
int vis[N], dist[N];
vector<vector<ll> > v(65);

ll bfs(ll node)
{
    queue<pair<int, int> > Q;
    Q.push({node, 0});
    vis[node] = node;
    while(!Q.empty())
    {
        auto curNode = Q.front();
        Q.pop();
        for(ll i = 0 ; i < 64 ; i++)
        {
            for(auto j:v[i])
            {
                if(((arr[curNode.F]>>i)&1LL) and j != curNode.F and vis[curNode.F] != j)
                {
                    if(vis[j]) return curNode.S+1 + dist[j];
                    vis[j] = curNode.F;
                    dist[j] = curNode.S+1;
                    Q.push({j, curNode.S+1});
                }
            }
        }
    }
    return 1e9;
}

int main()
{
    ll n, mn = 1e9;
    cin>>n;
    for(ll i = 1 ; i <= n ; i++)
    {
        cin>>arr[i];
        for(ll j = 0 ; j < 64 ; j++)
        {
            if((arr[i]>>j)&1LL) v[j].push_back(i);
        }
    }
    for(ll i = 0 ; i < 64 ; i++)
    {
        if(v[i].size() > 2) return cout<<3, 0;
    }
    for(ll i = 0 ; i < 64 ; i++)
    {
        for(auto j:v[i])
        {
            memset(vis, 0, (n+1) * sizeof vis[0]);
            memset(dist, 0, (n+1) * sizeof vis[0]);
            mn = min(mn, bfs(i));
        }
    }
    if(mn < 1e9) cout<<mn;
    else cout<<-1;
}


#include <bits/stdc++.h>
#define S second
#define F first
#define ll long long

using namespace std;

const ll N = 1e5+5;

ll arr[N];
int vis[N], dist[N];
vector<vector<ll> > v(65);

ll bfs(ll node)
{
    queue<pair<int, int> > Q;
    Q.push({node, 0});
    vis[node] = node;
    while(!Q.empty())
    {
        auto curNode = Q.front();
        Q.pop();
        for(ll i = 0 ; i < 64 ; i++)
        {
            for(auto j:v[i])
            {
                if(((arr[curNode.F]>>i)&1LL) and j != curNode.F and vis[curNode.F] != j)
                {
                    if(vis[j]) return curNode.S+1 + dist[j];
                    vis[j] = curNode.F;
                    dist[j] = curNode.S+1;
                    Q.push({j, curNode.S+1});
                }
            }
        }
    }
    return 1e9;
}

int main()
{
    ll n, mn = 1e9;
    cin>>n;
    for(ll i = 1 ; i <= n ; i++)
    {
        cin>>arr[i];
        for(ll j = 0 ; j < 64 ; j++)
        {
            if((arr[i]>>j)&1LL) v[j].push_back(i);
        }
    }
    for(ll i = 0 ; i < 64 ; i++)
    {
        if(v[i].size() > 2) return cout<<3, 0;
    }
    for(ll i = 1 ; i <= n ; i++)
    {
        memset(vis, 0, (n+1) * sizeof vis[0]);
        memset(dist, 0, (n+1) * sizeof vis[0]);
        mn = min(mn, bfs(i));
    }
    if(mn < 1e9) cout<<mn;
    else cout<<-1;
}


#include <bits/stdc++.h>
#define S second
#define F first
#define ll long long

using namespace std;

const ll N = 1e5+5;

ll arr[N], n;
int parent[N], dist[N];
vector<vector<ll> > v(65);

ll bfs(ll node)
{
    queue<pair<int, int> > Q;
    Q.push({node, 0});
    while(!Q.empty())
    {
        int Node = Q.front().F;
        int cost = Q.front().S;
        Q.pop();
        for(int i = 0 ; i < n ; i++)
        {
            if(i != Node and parent[Node] != i and (arr[i]&arr[Node]))
            {
                if(~dist[i]) return cost+1+dist[i];
                parent[i] = Node;
                dist[i] = cost+1;
                Q.push({i, cost+1});
            }
        }
    }
    return 1e9;
}

int main()
{
    ll mn = 1e9;
    cin>>n;
    for(ll i = 0 ; i < n ; i++)
    {
        cin>>arr[i];
        for(ll j = 0 ; j < 64 ; j++)
        {
            if((arr[i]>>j)&1LL) v[j].push_back(i);
        }
    }
    for(ll i = 0 ; i < 64 ; i++)
    {
        if(v[i].size() > 2) return cout<<3, 0;
    }
    for(ll i = 0 ; i < 64 ; i++)
    {
        for(auto j:v[i])
        {
            memset(parent, -1, n * sizeof parent[0]);
            memset(dist, -1, n * sizeof dist[0]);
            mn = min(mn, bfs(j));
        }
    }
    if(mn < 1e9) cout<<mn;
    else cout<<-1;
}


#include <bits/stdc++.h>
#define S second
#define F first
#define ll long long

using namespace std;

const ll N = 1e5+5;

ll arr[N];
int vis[N], dist[N];
vector<vector<ll> > v(65);

ll bfs(ll node)
{
    queue<pair<int, int> > Q;
    Q.push({node, 0});
    vis[node] = node;
    while(!Q.empty())
    {
        auto curNode = Q.front();
        Q.pop();
        for(ll i = 0 ; i < 64 ; i++)
        {
            for(auto j:v[i])
            {
                if(((arr[curNode.F]>>i)&1LL) and j != curNode.F and vis[curNode.F] != j)
                {
                    if(vis[j]) return curNode.S+1 + dist[j];
                    vis[j] = curNode.F;
                    dist[j] = curNode.S+1;
                    Q.push({j, curNode.S+1});
                }
            }
        }
    }
    return 1e9;
}

int main()
{
    ll n, mn = 1e9;
    cin>>n;
    for(ll i = 1 ; i <= n ; i++)
    {
        cin>>arr[i];
        for(ll j = 0 ; j < 64 ; j++)
        {
            if((arr[i]>>j)&1LL) v[j].push_back(i);
        }
    }
    for(ll i = 0 ; i < 64 ; i++)
    {
        if(v[i].size() > 2) return cout<<3, 0;
    }
    for(ll i = 0 ; i < 64 ; i++)
    {
        for(auto j:v[i])
        {
            memset(vis, 0, (n+1) * sizeof vis[0]);
            memset(dist, 0, (n+1) * sizeof vis[0]);
            mn = min(mn, bfs(j));
        }
    }
    if(mn < 1e9) cout<<mn;
    else cout<<-1;
}


#include <bits/stdc++.h>
#define S second
#define F first
#define ll long long

using namespace std;

const ll N = 1e5+5;

ll arr[N], dist;
int vis[N];
vector<vector<ll> > v(65);

ll dfs(ll node, ll d, ll p)
{
    if(vis[node] == 1 and node == dist) return d;
    if(vis[node] == 1) return 1e9;
    vis[node] = 1;
    ll ret = 1e9;
    for(ll i = 0 ; i < 64 ; i++)
    {
        for(auto j:v[i])
        {
            if(((arr[node]>>i)&1LL) and p != j and j != node)
            {
                ret = min(ret, dfs(j, d+1, node));
            }
        }
    }
    vis[node] = 2;
    return ret;
}

int main()
{
    ll n, mn = 1e9;
    cin>>n;
    for(ll i = 0 ; i < n ; i++)
    {
        cin>>arr[i];
        for(ll j = 0 ; j < 64 ; j++)
        {
            if((arr[i]>>j)&1LL) v[j].push_back(i);
        }
    }
    for(ll i = 0 ; i < 64 ; i++)
    {
        if(v[i].size() > 2) return cout<<3, 0;
    }
    for(ll i = 0 ; i < 64 ; i++)
    {
        for(auto j:v[i])
        {
            memset(vis, 0, n * sizeof vis[0]);
            dist = j;
            mn = min(mn, dfs(j, 0, -1));
        }
    }
    if(mn < 1e9) cout<<mn;
    else cout<<-1;
}


#include <bits/stdc++.h>
#define S second
#define F first
#define ll long long

using namespace std;

const ll N = 1e5+5;

ll arr[N], dist;
int vis[N];
vector<vector<ll> > v(65);

ll dfs(ll node, ll d, ll p)
{
    if(vis[node] == 1 and node == dist) return d;
    if(vis[node] == 1) return 1e9;
    vis[node] = 1;
    ll ret = 1e9;
    for(ll i = 0 ; i < 64 ; i++)
    {
        for(auto j:v[i])
        {
            if(((arr[node]>>i)&1LL) and p != j and j != node)
            {
                ret = min(ret, dfs(j, d+1, node));
            }
        }
    }
    vis[node] = 2;
    return ret;
}

int main()
{
    ll n, mn = 1e9;
    cin>>n;
    for(ll i = 0 ; i < n ; i++)
    {
        cin>>arr[i];
        for(ll j = 0 ; j < 64 ; j++)
        {
            if((arr[i]>>j)&1LL) v[j].push_back(i);
        }
    }
    for(ll i = 0 ; i < 64 ; i++)
    {
        if(v[i].size() > 2) return cout<<3, 0;
    }
    for(ll i = 0 ; i < 64 ; i++)
    {
        for(auto j:v[i])
        {
            memset(vis, 0, n * sizeof vis[0]);
            j = dist;
            mn = min(mn, dfs(j, 0, -1));
        }
    }
    if(mn < 1e9) cout<<mn;
    else cout<<-1;
}


#include <bits/stdc++.h>
#define S second
#define F first
#define ll long long

using namespace std;

const ll N = 1e5+5;

ll arr[N];
ll vis[N], visE[66], vid;
vector<vector<ll> > v(65);

ll dfs(ll node, ll d, ll p)
{
    if(vis[node] == vid)
    {
        if(d > 1) return d;
        return 1e9;
    }
    vis[node] = vid;
    ll ret = 1e9;
    for(ll i = 0 ; i < 64 ; i++)
    {
        for(auto j:v[i])
        {
            if(((arr[node]>>i)&1LL) and p != j and j != node)
            {
                ret = min(ret, dfs(j, d+1, node));
            }
        }
    }
    return ret;
}

int main()
{
    ll n, mn = 1e9;
    cin>>n;
    for(ll i = 0 ; i < n ; i++)
    {
        cin>>arr[i];
        for(ll j = 0 ; j < 64 ; j++)
        {
            if((arr[i]>>j)&1LL) v[j].push_back(i);
        }
    }
    for(ll i = 0 ; i < 64 ; i++)
    {
        if(v[i].size() > 2) return cout<<3, 0;
    }
    for(ll i = 0 ; i < 64 ; i++)
    {
        for(auto j:v[i])
        {
            ++vid;
            mn = min(mn, dfs(j, 0, -1));
        }
    }
    if(mn < 1e9) cout<<mn;
    else cout<<-1;
}


#include <bits/stdc++.h>
#define S second
#define F first
#define ll long long

using namespace std;

const ll N = 1e5+5;

ll arr[N];
int vis[N], dist[N];
vector<vector<ll> > v(65);

ll bfs(ll node)
{
    queue<pair<int, int> > Q;
    Q.push({node, 0});
    vis[node] = node;
    while(!Q.empty())
    {
        auto curNode = Q.front();
        Q.pop();
        for(ll i = 0 ; i < 64 ; i++)
        {
            for(auto j:v[i])
            {
                if(((arr[curNode.F]>>i)&1LL) and j != curNode.F and vis[curNode.F] != j)
                {
                    if(vis[j] and curNode.S+1 + dist[j] > 2) return curNode.S+1 + dist[j];
                    else if(vis[j]) continue;
                    vis[j] = curNode.F;
                    dist[j] = curNode.S+1;
                    Q.push({j, curNode.S+1});
                }
            }
        }
    }
    return 1e9;
}

int main()
{
    ll n, mn = 1e9;
    cin>>n;
    for(ll i = 1 ; i <= n ; i++)
    {
        cin>>arr[i];
        for(ll j = 0 ; j < 64 ; j++)
        {
            if((arr[i]>>j)&1LL) v[j].push_back(i);
        }
    }
    for(ll i = 0 ; i < 64 ; i++)
    {
        if(v[i].size() > 2) return cout<<3, 0;
    }
    for(ll i = 0 ; i < 64 ; i++)
    {
        for(auto j:v[i])
        {
            memset(vis, 0, (n+1) * sizeof vis[0]);
            memset(dist, 0, (n+1) * sizeof dist[0]);
            mn = min(mn, bfs(j));
        }
    }
    if(mn < 1e9) cout<<mn;
    else cout<<-1;
}


#include <bits/stdc++.h>
#define S second
#define F first
#define ll long long

using namespace std;

const ll N = 1e5+5;

ll arr[N], dist;
int vis[N];
vector<vector<ll> > v(66);

ll dfs(ll node, ll d, ll p)
{
    if(node == dist and d) return d;
    if(d > 128) return 1e9;
    ll ret = 1e9;
    for(ll i = 0 ; i < 65 ; i++)
    {
        for(auto j:v[i])
        {
            if(((arr[node]>>i)&1LL) and p != j and j != node)
            {
                ret = min(ret, dfs(j, d+1, node));
            }
        }
    }
    return ret;
}

int main()
{
    ll n, mn = 1e9;
    cin>>n;
    for(ll i = 0 ; i < n ; i++)
    {
        cin>>arr[i];
        for(ll j = 0 ; j < 65 ; j++)
        {
            if((arr[i]>>j)&1LL) v[j].push_back(i);
        }
    }
    for(ll i = 0 ; i < 65 ; i++)
    {
        if(v[i].size() > 2) return cout<<3, 0;
    }
    for(auto i:v)
    {
        for(auto j:i)
        {
            memset(vis, 0, n * sizeof vis[0]);
            dist = j;
            mn = min(mn, dfs(j, 0, -1));
        }
    }
    if(mn < 1e9) cout<<mn;
    else cout<<-1;
}


#include <bits/stdc++.h>
#define S second
#define F first
#define ll long long

using namespace std;

const ll N = 1e5+5;

ll arr[N], dist, dd[N][130];
int vis[N];
vector<vector<ll> > v(65);

ll dfs(ll node, ll d, ll p)
{
    if(vis[node] == 1 and node == dist) return d;
    if(vis[node] == 1) return 1e9;
    vis[node] = 1;
    ll &ret = dd[node][p];
    if(~ret) return ret;
    ret = 1e9;
    for(ll i = 0 ; i < 64 ; i++)
    {
        for(auto j:v[i])
        {
            if(((arr[node]>>i)&1LL) and p != j and j != node)
            {
                ret = min(ret, dfs(j, d+1, node));
            }
        }
    }
    vis[node] = 2;
    return ret;
}

int main()
{
    ll n, mn = 1e9;
    cin>>n;
    for(ll i = 0 ; i < n ; i++)
    {
        cin>>arr[i];
        for(ll j = 0 ; j < 64 ; j++)
        {
            if((arr[i]>>j)&1LL) v[j].push_back(i);
        }
    }
    for(ll i = 0 ; i < 64 ; i++)
    {
        if(v[i].size() > 2) return cout<<3, 0;
    }
    for(ll i = 0 ; i < 64 ; i++)
    {
        for(auto j:v[i])
        {
            memset(vis, 0, n * sizeof vis[0]);
            memset(dd, -1, n * sizeof dd[0]);
            dist = j;
            mn = min(mn, dfs(j, 0, j) > 2 ? dfs(j, 0, j) : mn);
        }
    }
    if(mn < 1e9) cout<<mn;
    else cout<<-1;
}


#include <bits/stdc++.h>
#define S second
#define F first
#define ll long long

using namespace std;

const ll N = 1e5+5;

ll arr[N];
int vis[N];
vector<vector<ll> > v(65);

ll dfs(ll node, ll d, ll p)
{
    if(vis[node] == 2) return 1e9;
    if(vis[node] == 1) return d;
    vis[node] = 1;
    ll ret = 1e9;
    for(ll i = 0 ; i < 64 ; i++)
    {
        for(auto j:v[i])
        {
            if(((arr[node]>>i)&1LL) and p != j and j != node)
            {
                ret = min(ret, dfs(j, d+1, node));
            }
        }
    }
    vis[node] = 2;
    return ret;
}

int main()
{
    ll n, mn = 1e9;
    cin>>n;
    for(ll i = 0 ; i < n ; i++)
    {
        cin>>arr[i];
        for(ll j = 0 ; j < 64 ; j++)
        {
            if((arr[i]>>j)&1LL) v[j].push_back(i);
        }
    }
    for(ll i = 0 ; i < 64 ; i++)
    {
        if(v[i].size() > 2) return cout<<3, 0;
    }
    for(ll i = 0 ; i < 64 ; i++)
    {
        for(auto j:v[i])
        {
            memset(vis, 0, n * sizeof vis[0]);
            mn = min(mn, dfs(j, 0, -1));
        }
    }
    if(mn < 1e9) cout<<mn;
    else cout<<-1;
}


#include <bits/stdc++.h>
using namespace std;

#define fori(i,a,b)    for(int i=a;i<=b;i++)
#define ford(i,a,b)   for(int i=a;i>=b;i--)
#define all(a)        a.begin(), a.end()
#define in(c,x)       ((c).find(x) != (c).end())
#define isp(c,x)      (find(all(c),x) != (c).end())
#define pb             push_back
#define ppb            pop_back
#define sz(x)          (int)x.size()
#define fill(a,v)      memset(a, v, sizeof a)
#define fs first
#define sc second
#define ub upper_bound
#define lb lower_bound
#define en '\n'

typedef long long int lli;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long int> vlli;
typedef pair< int, int > pii;
typedef pair< lli, lli > plli;
typedef list<int> li;
typedef map<int, int> mi;
typedef map<lli, lli> mlli;
lli gcd(lli a,lli b){return (!b)?a:gcd(b,a%b);}
int t = 1; int ti;

void solve(){

    int a[2][100];

    fori(i, 0, 99)
    a[0][i] = i;

    fori(i, 0, 99)
    a[1][i] = (1<<7)+i;

    cout<<"? ";

    fori(i, 0, 99)
    cout<<a[0][i]<<" ";

    cout << endl;
    cout.flush();
    int y1; cin>>y1;

    if(y1 == -1){
        exit(0);
    }

    cout<<"? ";

    fori(i, 0, 99)
    cout<<a[1][i]<<" ";

    cout << endl;
    cout.flush();

    int y2; cin>>y2;

    if(y2 == -1){
        exit(0);
    }

    y1 >>= 7;
    y1 <<= 7;

    y2 <<= 7;
    y2 >>= 7;

    int ans = y1 + y2;
    cout<<"! ";
    cout<<ans;

    exit(0);
}
//THINK OF SPECIAL CASES, ARRAY LIMITS, LLI vs INT, 1LL

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    // cin>>t;

    // for(ti= 1; ti <= t; ti++)
    solve();

    cout<<"\nTHINK OF SPECIAL CASES, ARRAY LIMITS, LLI vs INT, 1LL";
}


#include <bits/stdc++.h>
using namespace std;

#define fori(i,a,b)    for(int i=a;i<=b;i++)
#define ford(i,a,b)   for(int i=a;i>=b;i--)
#define all(a)        a.begin(), a.end()
#define in(c,x)       ((c).find(x) != (c).end())
#define isp(c,x)      (find(all(c),x) != (c).end())
#define pb             push_back
#define ppb            pop_back
#define sz(x)          (int)x.size()
#define fill(a,v)      memset(a, v, sizeof a)
#define fs first
#define sc second
#define ub upper_bound
#define lb lower_bound
#define en '\n'

typedef long long int lli;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long int> vlli;
typedef pair< int, int > pii;
typedef pair< lli, lli > plli;
typedef list<int> li;
typedef map<int, int> mi;
typedef map<lli, lli> mlli;
lli gcd(lli a,lli b){return (!b)?a:gcd(b,a%b);}
int t = 1; int ti;

void solve(){

    int a[2][100];

    fori(i, 1, 100)
    a[0][i-1] = i;

    fori(i, 1, 100)
    a[1][i-1] = (1<<7)+i;

    cout<<"? ";

    fori(i, 0, 99)
    cout<<a[0][i]<<" ";

    cout << endl;
    cout.flush();
    int y1; cin>>y1;

    if(y1 == -1){
        exit(0);
    }

    cout<<"? ";

    fori(i, 0, 99)
    cout<<a[1][i]<<" ";

    cout << endl;
    cout.flush();

    int y2; cin>>y2;

    if(y2 == -1){
        exit(0);
    }

    // y1 >>= 7;
    // y1 <<= 7;
    y1 &= (((1<<7)-1)<<7);

    y2 &= ((1<<7)-1);

    int ans = y1 + y2;
    cout<<"! ";
    cout<<ans;

   exit(0);
}
//THINK OF SPECIAL CASES, ARRAY LIMITS, LLI vs INT, 1LL

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    // cin>>t;

    // for(ti= 1; ti <= t; ti++)
    solve();

    cout<<"\nTHINK OF SPECIAL CASES, ARRAY LIMITS, LLI vs INT, 1LL";
}


#include <bits/stdc++.h>
using namespace std;

#define fori(i,a,b)    for(int i=a;i<=b;i++)
#define ford(i,a,b)   for(int i=a;i>=b;i--)
#define all(a)        a.begin(), a.end()
#define in(c,x)       ((c).find(x) != (c).end())
#define isp(c,x)      (find(all(c),x) != (c).end())
#define pb             push_back
#define ppb            pop_back
#define sz(x)          (int)x.size()
#define fill(a,v)      memset(a, v, sizeof a)
#define fs first
#define sc second
#define ub upper_bound
#define lb lower_bound
#define en '\n'

typedef long long int lli;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long int> vlli;
typedef pair< int, int > pii;
typedef pair< lli, lli > plli;
typedef list<int> li;
typedef map<int, int> mi;
typedef map<lli, lli> mlli;
lli gcd(lli a,lli b){return (!b)?a:gcd(b,a%b);}
int t = 1; int ti;

void solve(){

    int a[2][100];

    fori(i, 0, 99)
    a[0][i] = i;

    fori(i, 0, 99)
    a[1][i] = 100+i;

    cout<<"? ";

    fori(i, 0, 99)
    cout<<a[0][i]<<" ";

    cout << endl;
    cout.flush();
    int y1; cin>>y1;

    if(y1 == -1){
        exit(0);
    }

    cout<<"? ";

    fori(i, 0, 99)
    cout<<a[1][i]<<" ";

    cout << endl;
    cout.flush();

    int y2; cin>>y2;

    if(y2 == -1){
        exit(0);
    }

    fori(i, 0, 99){
        fori(j, 0, 99){
            if(y1^a[0][i] == y2^a[1][j]){
                cout<<"! "<<(y1^a[0][i]);
            }
        }
    }

}
//THINK OF SPECIAL CASES, ARRAY LIMITS, LLI vs INT, 1LL

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    // cin>>t;

    // for(ti= 1; ti <= t; ti++)
    solve();

    cout<<"\nTHINK OF SPECIAL CASES, ARRAY LIMITS, LLI vs INT, 1LL";
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<deque>
#include<cmath>
#include<vector>
#include<algorithm>
#include<sstream>
#define lowbit(x) ((x)&(-(x)))
#define set0(x) memset((x),0,sizeof(x))
#define setinf(x) memset((x),inf,sizeof(x))
#define set1(x) memset((x),-1,sizeof(x))
#define ddd puts("-----debug-----");
#define pt(x) puts("(x)");
#define F(x,a,b) for(int (x)=(a);(x)<=(b);(x)++)
#define edge1() const int maxm=1e6+5;int head[maxm],nt[maxm],to[maxm],w[maxm],cnt;void init1(){set1(head);cnt=-1;}void add(int x,int y,int z){cnt++;nt[cnt]=head[x];head[x]=cnt;to[cnt]=y;w[cnt]=z;}
typedef long long ll;
const int inf=0x3f3f3f3f;
const int inn=0x80808080;
using namespace std;

int main(){
    printf("? ");
    for(int i=1;i<=100;i++){
        printf(" %d",i);
    }
    puts("");

    fflush(stdout);//清空

    int t;
    scanf("%d",&t);
    int ans=0;
    for(int i=7;i<14;i++){
        ans+=((t>>i&1)<<i);
    }

//    fflush(stdout);//

    printf("? ");
    for(int i=1;i<=100;i++){
        printf(" %d",i<<7);
    }
    puts("");

//    fflush(stdout);//清空

    scanf("%d",&t);
    for(int i=0;i<7;i++){
        ans+=((t>>i&1)<<i);
    }
    printf("! %d",ans);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<deque>
#include<cmath>
#include<vector>
#include<algorithm>
#include<sstream>
#define lowbit(x) ((x)&(-(x)))
#define set0(x) memset((x),0,sizeof(x))
#define setinf(x) memset((x),inf,sizeof(x))
#define set1(x) memset((x),-1,sizeof(x))
#define ddd puts("-----debug-----");
#define pt(x) puts("(x)");
#define F(x,a,b) for(int (x)=(a);(x)<=(b);(x)++)
#define edge1() const int maxm=1e6+5;int head[maxm],nt[maxm],to[maxm],w[maxm],cnt;void init1(){set1(head);cnt=-1;}void add(int x,int y,int z){cnt++;nt[cnt]=head[x];head[x]=cnt;to[cnt]=y;w[cnt]=z;}
typedef long long ll;
const int inf=0x3f3f3f3f;
const int inn=0x80808080;
using namespace std;

int main(){
//    fflush(stdout);
    printf("? ");
    for(int i=1;i<=100;i++){
        printf(" %d",i);
    }
    puts("");
    fflush(stdout);
    int t;
    scanf("%d",&t);
    int ans=0;
    for(int i=7;i<14;i++){
        ans+=((t>>i&1)<<i);
    }
    fflush(stdout);
    printf("? ");
    for(int i=1;i<=100;i++){
        printf(" %d",i<<7);
    }
    puts("");
    fflush(stdout);
    scanf("%d",&t);
    for(int i=0;i<7;i++){
        ans+=((t>>i&1)<<i);
    }
    printf("! %d",ans);
//    fflush(stdout);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<deque>
#include<cmath>
#include<vector>
#include<algorithm>
#include<sstream>
#define lowbit(x) ((x)&(-(x)))
#define set0(x) memset((x),0,sizeof(x))
#define setinf(x) memset((x),inf,sizeof(x))
#define set1(x) memset((x),-1,sizeof(x))
#define ddd puts("-----debug-----");
#define pt(x) puts("(x)");
#define F(x,a,b) for(int (x)=(a);(x)<=(b);(x)++)
#define edge1() const int maxm=1e6+5;int head[maxm],nt[maxm],to[maxm],w[maxm],cnt;void init1(){set1(head);cnt=-1;}void add(int x,int y,int z){cnt++;nt[cnt]=head[x];head[x]=cnt;to[cnt]=y;w[cnt]=z;}
typedef long long ll;
const int inf=0x3f3f3f3f;
const int inn=0x80808080;
using namespace std;

int main(){
    printf("? ");
    for(int i=1;i<=100;i++){
        printf(" %d",i);
    }
    puts("");

    fflush(stdin);//清空

    int t;
    scanf("%d",&t);
    int ans=0;
    for(int i=7;i<14;i++){
        ans+=((t>>i&1)<<i);
    }

//    fflush(stdout);//

    printf("? ");
    for(int i=1;i<=100;i++){
        printf(" %d",i<<7);
    }
    puts("");

    fflush(stdout);//清空

    scanf("%d",&t);
    for(int i=0;i<7;i++){
        ans+=((t>>i&1)<<i);
    }
    printf("! %d",ans);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<deque>
#include<cmath>
#include<vector>
#include<algorithm>
#include<sstream>
#define lowbit(x) ((x)&(-(x)))
#define set0(x) memset((x),0,sizeof(x))
#define setinf(x) memset((x),inf,sizeof(x))
#define set1(x) memset((x),-1,sizeof(x))
#define ddd puts("-----debug-----");
#define pt(x) puts("(x)");
#define F(x,a,b) for(int (x)=(a);(x)<=(b);(x)++)
#define edge1() const int maxm=1e6+5;int head[maxm],nt[maxm],to[maxm],w[maxm],cnt;void init1(){set1(head);cnt=-1;}void add(int x,int y,int z){cnt++;nt[cnt]=head[x];head[x]=cnt;to[cnt]=y;w[cnt]=z;}
typedef long long ll;
const int inf=0x3f3f3f3f;
const int inn=0x80808080;
using namespace std;

int main(){
    fflush(stdout);
    printf("? ");
    for(int i=1;i<=100;i++){
        printf(" %d",i);
    }
    puts("");
    fflush(stdout);
    int t;
    scanf("%d",&t);
    int ans=0;
    for(int i=7;i<14;i++){
        ans+=((t>>i&1)<<i);
    }
    fflush(stdout);
    printf("? ");
    for(int i=(1<<7),cnt=0;cnt<100;i++,cnt++){
        printf(" %d",i);
    }
    puts("");
    fflush(stdout);
    scanf("%d",&t);
    for(int i=0;i<7;i++){
        ans+=((t>>i&1)<<i);
    }
    printf("! %d",ans);
    fflush(stdout);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<deque>
#include<cmath>
#include<vector>
#include<algorithm>
#include<sstream>
#define lowbit(x) ((x)&(-(x)))
#define set0(x) memset((x),0,sizeof(x))
#define setinf(x) memset((x),inf,sizeof(x))
#define set1(x) memset((x),-1,sizeof(x))
#define ddd puts("-----debug-----");
#define F(x,a,b) for(int (x)=(a);(x)<=(b);(x)++)
#define edge1() const int maxm=1e6+5;int head[maxm],nt[maxm],to[maxm],w[maxm],cnt;void init1(){set1(head);cnt=-1;}void add(int x,int y,int z){cnt++;nt[cnt]=head[x];head[x]=cnt;to[cnt]=y;w[cnt]=z;}
typedef long long ll;
const int inf=0x3f3f3f3f;
const int inn=0x80808080;
using namespace std;

int main(){
    cout<<"? ";
    for(int i=1;i<=100;i++){
        cout<<i<<' ';
    }
    fflush(stdout);
    int t;
    cin>>t;
    int ans=0;
    for(int i=7;i<14;i++){
        ans|=(t>>i&1)<<i;
    }
    cout<<"? ";
    for(int i=(1<<7)-1,cnt=0;cnt<100;cnt++,i++){
        cout<<i<<' ';
    }
    fflush(stdout);
    cin>>t;
    for(int i=0;i<7;i++){
        ans|=(t>>i&1)<<i;
    }
    cout<<"! "<<ans<<endl;
    return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<deque>
#include<cmath>
#include<vector>
#include<algorithm>
#include<sstream>
#define lowbit(x) ((x)&(-(x)))
#define set0(x) memset((x),0,sizeof(x))
#define setinf(x) memset((x),inf,sizeof(x))
#define set1(x) memset((x),-1,sizeof(x))
#define ddd puts("-----debug-----");
#define pt(x) puts("(x)");
#define F(x,a,b) for(int (x)=(a);(x)<=(b);(x)++)
#define edge1() const int maxm=1e6+5;int head[maxm],nt[maxm],to[maxm],w[maxm],cnt;void init1(){set1(head);cnt=-1;}void add(int x,int y,int z){cnt++;nt[cnt]=head[x];head[x]=cnt;to[cnt]=y;w[cnt]=z;}
typedef long long ll;
const int inf=0x3f3f3f3f;
const int inn=0x80808080;
using namespace std;

int main(){
    printf("? ");
    for(int i=1;i<=100;i++){
        printf(" %d",i);
    }
    puts("");
    int t;
    scanf("%d",&t);
    int ans=0;
    for(int i=7;i<14;i++){
        ans+=((t>>i&1)<<i);
    }
    fflush(stdout);
    printf("? ");
    for(int i=(1<<7),cnt=0;cnt<100;i++,cnt++){
        printf(" %d",i);
    }
    puts("");
    fflush(stdout);
    scanf("%d",&t);
    for(int i=0;i<7;i++){
        ans+=((t>>i&1)<<i);
    }
    printf("! %d",ans);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<deque>
#include<cmath>
#include<vector>
#include<algorithm>
#include<sstream>
#define lowbit(x) ((x)&(-(x)))
#define set0(x) memset((x),0,sizeof(x))
#define setinf(x) memset((x),inf,sizeof(x))
#define set1(x) memset((x),-1,sizeof(x))
#define ddd puts("-----debug-----");
#define pt(x) puts("(x)");
#define F(x,a,b) for(int (x)=(a);(x)<=(b);(x)++)
#define edge1() const int maxm=1e6+5;int head[maxm],nt[maxm],to[maxm],w[maxm],cnt;void init1(){set1(head);cnt=-1;}void add(int x,int y,int z){cnt++;nt[cnt]=head[x];head[x]=cnt;to[cnt]=y;w[cnt]=z;}
typedef long long ll;
const int inf=0x3f3f3f3f;
const int inn=0x80808080;
using namespace std;

int main(){
    printf("? ");
    for(int i=1;i<=100;i++){
        printf(" %d",i);
    }
    puts("");
//    fflush(stdout);
    int t;
    scanf("%d",&t);
    int ans=0;
    for(int i=7;i<14;i++){
        ans+=((t>>i&1)<<i);
    }
    fflush(stdout);
    printf("? ");
    for(int i=1;i<=100;i++){
        printf(" %d",i<<7);
    }
    puts("");
    fflush(stdout);
    scanf("%d",&t);
    for(int i=0;i<7;i++){
        ans+=((t>>i&1)<<i);
    }
    printf("! %d",ans);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<deque>
#include<cmath>
#include<vector>
#include<algorithm>
#include<sstream>
#define lowbit(x) ((x)&(-(x)))
#define set0(x) memset((x),0,sizeof(x))
#define setinf(x) memset((x),inf,sizeof(x))
#define set1(x) memset((x),-1,sizeof(x))
#define ddd puts("-----debug-----");
#define pt(x) puts("(x)");
#define F(x,a,b) for(int (x)=(a);(x)<=(b);(x)++)
#define edge1() const int maxm=1e6+5;int head[maxm],nt[maxm],to[maxm],w[maxm],cnt;void init1(){set1(head);cnt=-1;}void add(int x,int y,int z){cnt++;nt[cnt]=head[x];head[x]=cnt;to[cnt]=y;w[cnt]=z;}
typedef long long ll;
const int inf=0x3f3f3f3f;
const int inn=0x80808080;
using namespace std;

int main(){
    printf("? ");
    for(int i=1;i<=100;i++){
        printf(" %d",i);
    }
    puts("");
    fflush(stdout);//
    int t;
    scanf("%d",&t);
    int ans=0;
    for(int i=7;i<14;i++){
        ans+=((t>>i&1)<<i);
    }
//    fflush(stdout);//
    printf("? ");
    for(int i=1;i<=100;i++){
        printf(" %d",i<<7);
    }
    puts("");
    fflush(stdout);//
    scanf("%d",&t);
    for(int i=0;i<7;i++){
        ans+=((t>>i&1)<<i);
    }
    printf("! %d",ans);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<deque>
#include<cmath>
#include<vector>
#include<algorithm>
#include<sstream>
#define lowbit(x) ((x)&(-(x)))
#define set0(x) memset((x),0,sizeof(x))
#define setinf(x) memset((x),inf,sizeof(x))
#define set1(x) memset((x),-1,sizeof(x))
#define ddd puts("-----debug-----");
#define F(x,a,b) for(int (x)=(a);(x)<=(b);(x)++)
#define edge1() const int maxm=1e6+5;int head[maxm],nt[maxm],to[maxm],w[maxm],cnt;void init1(){set1(head);cnt=-1;}void add(int x,int y,int z){cnt++;nt[cnt]=head[x];head[x]=cnt;to[cnt]=y;w[cnt]=z;}
typedef long long ll;
const int inf=0x3f3f3f3f;
const int inn=0x80808080;
using namespace std;

int main(){
    printf("?");
    for(int i=1;i<=100;i++){
        printf(" %d",i);
    }
    puts("");
    fflush(stdout);
    int t;
    scanf("%d",&t);
    int ans=0;
    for(int i=7;i<14;i++){
        ans|=(t>>i&1)<<i;
    }
    printf("?");
    for(int i=(1<<7)-1,cnt=0;cnt<100;cnt++,i++){
        printf(" %d",i);
    }
    puts("");
    fflush(stdout);
    scanf("%d",&t);
    for(int i=0;i<7;i++){
        ans|=(t>>i&1)<<i;
    }
    printf("! %d\n",ans);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<deque>
#include<cmath>
#include<vector>
#include<algorithm>
#include<sstream>
#define lowbit(x) ((x)&(-(x)))
#define set0(x) memset((x),0,sizeof(x))
#define setinf(x) memset((x),inf,sizeof(x))
#define set1(x) memset((x),-1,sizeof(x))
#define ddd puts("-----debug-----");
#define F(x,a,b) for(int (x)=(a);(x)<=(b);(x)++)
#define edge1() const int maxm=1e6+5;int head[maxm],nt[maxm],to[maxm],w[maxm],cnt;void init1(){set1(head);cnt=-1;}void add(int x,int y,int z){cnt++;nt[cnt]=head[x];head[x]=cnt;to[cnt]=y;w[cnt]=z;}
typedef long long ll;
const int inf=0x3f3f3f3f;
const int inn=0x80808080;
using namespace std;

int main(){
    cout<<"? ";
    for(int i=1;i<=100;i++){
        cout<<i<<' ';
    }
    cout<<endl;
    fflush(stdout);
    int t;
    cin>>t;
    int ans=0;
    for(int i=7;i<14;i++){
        ans|=(t>>i&1)<<i;
    }
    cout<<"? ";
    for(int i=(1<<7)-1,cnt=0;cnt<100;cnt++,i++){
        cout<<i<<' ';
    }
    cout<<endl;
    fflush(stdout);
    cin>>t;
    for(int i=0;i<7;i++){
        ans|=(t>>i&1)<<i;
    }
    cout<<"! "<<ans<<endl;
    return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<deque>
#include<cmath>
#include<vector>
#include<algorithm>
#include<sstream>
#define lowbit(x) ((x)&(-(x)))
#define set0(x) memset((x),0,sizeof(x))
#define setinf(x) memset((x),inf,sizeof(x))
#define set1(x) memset((x),-1,sizeof(x))
#define ddd puts("-----debug-----");
#define pt(x) puts("(x)");
#define F(x,a,b) for(int (x)=(a);(x)<=(b);(x)++)
#define edge1() const int maxm=1e6+5;int head[maxm],nt[maxm],to[maxm],w[maxm],cnt;void init1(){set1(head);cnt=-1;}void add(int x,int y,int z){cnt++;nt[cnt]=head[x];head[x]=cnt;to[cnt]=y;w[cnt]=z;}
typedef long long ll;
const int inf=0x3f3f3f3f;
const int inn=0x80808080;
using namespace std;

int main(){
    fflush(stdout);
    printf("? ");
    for(int i=1;i<=100;i++){
        printf(" %d",i);
    }
    puts("");
    fflush(stdout);
    int t;
    scanf("%d",&t);
    int ans=0;
    for(int i=7;i<14;i++){
        ans+=((t>>i&1)<<i);
    }
    fflush(stdout);
    printf("? ");
    for(int i=1;i<=100;i++){
        printf(" %d",i<<7);
    }
    puts("");
    fflush(stdout);
    scanf("%d",&t);
    for(int i=0;i<7;i++){
        ans+=((t>>i&1)<<i);
    }
    printf("! %d",ans);
    fflush(stdout);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<deque>
#include<cmath>
#include<vector>
#include<algorithm>
#include<sstream>
#define lowbit(x) ((x)&(-(x)))
#define set0(x) memset((x),0,sizeof(x))
#define setinf(x) memset((x),inf,sizeof(x))
#define set1(x) memset((x),-1,sizeof(x))
#define ddd puts("-----debug-----");
#define pt(x) puts("(x)");
#define F(x,a,b) for(int (x)=(a);(x)<=(b);(x)++)
#define edge1() const int maxm=1e6+5;int head[maxm],nt[maxm],to[maxm],w[maxm],cnt;void init1(){set1(head);cnt=-1;}void add(int x,int y,int z){cnt++;nt[cnt]=head[x];head[x]=cnt;to[cnt]=y;w[cnt]=z;}
typedef long long ll;
const int inf=0x3f3f3f3f;
const int inn=0x80808080;
using namespace std;

int main(){
    printf("? ");
    for(int i=1;i<=100;i++){
        printf(" %d",i);
    }
    puts("");
    int t;
    scanf("%d",&t);
    int ans=0;
    for(int i=7;i<14;i++){
        ans+=((t>>i&1)<<i);
    }
    fflush(stdout);
    printf("? ");
    for(int i=(1<<7),cnt=0;cnt<100;i++,cnt++){
        printf(" %d",i);
    }
    puts("");
    scanf("%d",&t);
    for(int i=0;i<7;i++){
        ans+=((t>>i&1)<<i);
    }
    printf("! %d",ans);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<deque>
#include<cmath>
#include<vector>
#include<algorithm>
#include<sstream>
#define lowbit(x) ((x)&(-(x)))
#define set0(x) memset((x),0,sizeof(x))
#define setinf(x) memset((x),inf,sizeof(x))
#define set1(x) memset((x),-1,sizeof(x))
#define ddd puts("-----debug-----");
#define F(x,a,b) for(int (x)=(a);(x)<=(b);(x)++)
#define edge1() const int maxm=1e6+5;int head[maxm],nt[maxm],to[maxm],w[maxm],cnt;void init1(){set1(head);cnt=-1;}void add(int x,int y,int z){cnt++;nt[cnt]=head[x];head[x]=cnt;to[cnt]=y;w[cnt]=z;}
typedef long long ll;
const int inf=0x3f3f3f3f;
const int inn=0x80808080;
using namespace std;

int main(){
    printf("?");
    for(int i=1;i<=100;i++){
        printf(" %d",i);
    }
    puts("");
    fflush(stdout);
    int t;
    scanf("%d",&t);
    int ans=0;
    for(int i=7;i<14;i++){
        ans|=(t>>i&1)<<i;
    }
    printf("?");
    for(int i=(1<<7),cnt=0;cnt<100;cnt++,i++){
        printf(" %d",i);
    }
    puts("");
    fflush(stdout);
    scanf("%d",&t);
    for(int i=0;i<7;i++){
        ans|=(t>>i&1)<<i;
    }
    printf("! %d\n",ans);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<deque>
#include<cmath>
#include<vector>
#include<algorithm>
#include<sstream>
#define lowbit(x) ((x)&(-(x)))
#define set0(x) memset((x),0,sizeof(x))
#define setinf(x) memset((x),inf,sizeof(x))
#define set1(x) memset((x),-1,sizeof(x))
#define ddd puts("-----debug-----");
#define pt(x) puts("(x)");
#define F(x,a,b) for(int (x)=(a);(x)<=(b);(x)++)
#define edge1() const int maxm=1e6+5;int head[maxm],nt[maxm],to[maxm],w[maxm],cnt;void init1(){set1(head);cnt=-1;}void add(int x,int y,int z){cnt++;nt[cnt]=head[x];head[x]=cnt;to[cnt]=y;w[cnt]=z;}
typedef long long ll;
const int inf=0x3f3f3f3f;
const int inn=0x80808080;
using namespace std;

int main(){
    printf("? ");
    for(int i=1;i<=100;i++){
        printf(" %d",i);
    }
    puts("");
    fflush(stdout);
    //
    int t;
    scanf("%d",&t);
    int ans=0;
    for(int i=7;i<14;i++){
        ans+=((t>>i&1)<<i);
    }
    //
    printf("? ");
    for(int i=1;i<=100;i++){
        printf(" %d",i<<7);
    }
    puts("");
    fflush(stdout);
    //
    scanf("%d",&t);
    for(int i=0;i<7;i++){
        ans+=((t>>i&1)<<i);
    }
    printf("! %d",ans);
    fflush(stdout);//这个地方可以不加了
    return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<deque>
#include<cmath>
#include<vector>
#include<algorithm>
#include<sstream>
#define lowbit(x) ((x)&(-(x)))
#define set0(x) memset((x),0,sizeof(x))
#define setinf(x) memset((x),inf,sizeof(x))
#define set1(x) memset((x),-1,sizeof(x))
#define ddd puts("-----debug-----");
#define pt(x) puts("(x)");
#define F(x,a,b) for(int (x)=(a);(x)<=(b);(x)++)
#define edge1() const int maxm=1e6+5;int head[maxm],nt[maxm],to[maxm],w[maxm],cnt;void init1(){set1(head);cnt=-1;}void add(int x,int y,int z){cnt++;nt[cnt]=head[x];head[x]=cnt;to[cnt]=y;w[cnt]=z;}
typedef long long ll;
const int inf=0x3f3f3f3f;
const int inn=0x80808080;
using namespace std;

int main(){
    fflush(stdout);
    printf("? ");
    for(int i=1;i<=100;i++){
        printf(" %d",i);
    }
    puts("");
    fflush(stdout);
    ll t;
    scanf("%I64d",&t);
    int ans=0;
    for(int i=7;i<14;i++){
        ans+=((t>>i&1)<<i);
    }
    fflush(stdout);
    printf("? ");
    for(int i=(1<<7),cnt=0;cnt<100;i++,cnt++){
        printf(" %d",i);
    }
    puts("");
    fflush(stdout);
    scanf("%I64d",&t);
    for(int i=0;i<7;i++){
        ans+=((t>>i&1)<<i);
    }
    printf("! %d",ans);
    fflush(stdout);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<deque>
#include<cmath>
#include<vector>
#include<algorithm>
#include<sstream>
#define lowbit(x) ((x)&(-(x)))
#define set0(x) memset((x),0,sizeof(x))
#define setinf(x) memset((x),inf,sizeof(x))
#define set1(x) memset((x),-1,sizeof(x))
#define ddd puts("-----debug-----");
#define pt(x) puts("(x)");
#define F(x,a,b) for(int (x)=(a);(x)<=(b);(x)++)
#define edge1() const int maxm=1e6+5;int head[maxm],nt[maxm],to[maxm],w[maxm],cnt;void init1(){set1(head);cnt=-1;}void add(int x,int y,int z){cnt++;nt[cnt]=head[x];head[x]=cnt;to[cnt]=y;w[cnt]=z;}
typedef long long ll;
const int inf=0x3f3f3f3f;
const int inn=0x80808080;
using namespace std;

int main(){
    printf("? ");
    for(int i=1;i<=100;i++){
        printf(" %d",i);
    }
    puts("");
    fflush(stdout);
    int t;
    scanf("%d",&t);
    int ans=0;
    for(int i=7;i<14;i++){
        ans+=((t>>i&1)<<i);
    }
    fflush(stdout);
    printf("? ");
    for(int i=(1<<7),cnt=0;cnt<100;i++,cnt++){
        printf(" %d",i);
    }
    puts("");
    fflush(stdout);
    scanf("%d",&t);
    for(int i=0;i<7;i++){
        ans+=((t>>i&1)<<i);
    }
    printf("! %d",ans);
    fflush(stdout);
    return 0;
}


    // In the name of Allah
    // There is no power but from God the Almighty
    // No God except Allah
    #include <bits/stdc++.h>
    #define mp make_pair
    #define f1 first
    #define f2 second
    #define pb push_back
    #define pii pair<int ,int>
    #define ios  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    using namespace std;
    const int mox=3e6+9;
    main()
    {

         cout<<'?'<<" ";
         for(int i=0 ; i<100 ; i++)
            cout<<i<<" ";
         cout<<'\n';
         int x;
         cin>>x;
        cout<<'?'<<" ";
         for(int i=1 ; i<100 ; i++)
            cout<<(i*128)<<" ";
             cout<<'\n';
            int y;
            cin>>y;
            x/=128;
            y%=128;
            x^=y;
            cout<<'!'<<" "<<x;
    }


    // In the name of Allah
    // There is no power but from God the Almighty
    // No God except Allah
    #include <bits/stdc++.h>
    #define mp make_pair
    #define f1 first
    #define f2 second
    #define pb push_back
    #define pii pair<int ,int>
    #define ios  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    using namespace std;
    const int mox=3e6+9;
    main()
    {

         cout<<'?'<<" ";
         for(int i=0 ; i<100 ; i++)
            cout<<i<<" ";
         cout<<'\n';
         int x;
         cin>>x;
        cout<<'?'<<" ";
         for(int i=1 ; i<=100 ; i++)
            cout<<(i*128)<<" ";
             cout<<'\n';
            int y;
            cin>>y;
            x/=64;
            y%=128;
            x^=y;
            cout<<'!'<<" "<<x;
    }


    // In the name of Allah
    // There is no power but from God the Almighty
    // No God except Allah
    #include <bits/stdc++.h>
    #define mp make_pair
    #define f1 first
    #define f2 second
    #define pb push_back
    #define pii pair<int ,int>
    #define ios  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    using namespace std;
    const int mox=3e6+9;
    main()
    {

         cout<<'?'<<" ";
         for(int i=0 ; i<100 ; i++)
            cout<<i<<" ";
         cout<<'\n';
         int x;
         cin>>x;
        cout<<'?'<<" ";
         for(int i=1 ; i<100 ; i++)
            cout<<(i*128)<<" ";
             cout<<'\n';
            int y;
            cin>>y;
            x/=128;
            y%=128;
            x^=y;
            cout<<'!'<<x;
    }


    // In the name of Allah
    // There is no power but from God the Almighty
    // No God except Allah
    #include <bits/stdc++.h>
    #define mp make_pair
    #define f1 first
    #define f2 second
    #define pb push_back
    #define pii pair<int ,int>
    #define ios  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    using namespace std;
    const int mox=3e6+9;
    main()
    {

         cout<<'?'<<" ";
         for(int i=0 ; i<100 ; i++)
            cout<<i<<" ";
         cout<<'\n';
         int x;
         cin>>x;
        cout<<'?'<<" ";
         for(int i=1 ; i<100 ; i++)
            cout<<(i*128)<<" ";
             cout<<'\n';
            int y;
            cin>>y;
            x/=128;
            y%=128;
            x^=y;
            cout<<'!'<<" "<<x;
            return 0;
    }


    // In the name of Allah
    // There is no power but from God the Almighty
    // No God except Allah
    #include <bits/stdc++.h>
    #define mp make_pair
    #define f1 first
    #define f2 second
    #define pb push_back
    #define pii pair<int ,int>
    #define ios  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    using namespace std;
    const int mox=3e6+9;
    main()
    {

         cout<<'?'<<" ";
         for(int i=0 ; i<100 ; i++)
            cout<<i<<" ";
         cout<<'\n';
         int x;
         cin>>x;
        cout<<'?'<<" ";
         for(int i=1 ; i<100 ; i++)
            cout<<(i*128)<<" ";
             cout<<'\n';
            int y;
            cin>>y;
            x/=128;
            y%=128;
            x^=y;
            cout<<'!'<<" "<<x<<'\n';
            return 0;
    }


    // In the name of Allah
    // There is no power but from God the Almighty
    // No God except Allah
    #include <bits/stdc++.h>
    #define mp make_pair
    #define f1 first
    #define f2 second
    #define pb push_back
    #define pii pair<int ,int>
    #define ios  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    using namespace std;
    const int mox=3e6+9;
    main()
    {

         cout<<'?'<<" ";
         for(int i=0 ; i<100 ; i++)
            cout<<i<<" ";
         cout<<'\n';
         int x;
         cin>>x;
        cout<<'?'<<" ";
         for(int i=1 ; i<=100 ; i++)
            cout<<(i*128)<<" ";
             cout<<'\n';
            int y;
            cin>>y;
            x/=128;
            x*=128;
            y%=128;
            x+=y;
            cout<<'!'<<" "<<x;
    }


    // In the name of Allah
    // There is no power but from God the Almighty
    // No God except Allah
    #include <bits/stdc++.h>
    #define mp make_pair
    #define f1 first
    #define f2 second
    #define pb push_back
    #define pii pair<int ,int>
    #define ios  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    using namespace std;
    const int mox=3e6+9;
    main()
    {

         cout<<'?'<<" ";
         for(int i=0 ; i<100 ; i++)
            cout<<i<<" ";
         cout<<'\n';
         int x;
         cin>>x;
        cout<<'?'<<" ";
         for(int i=0 ; i<100 ; i++)
            cout<<(i*128)<<" ";
             cout<<'\n';
            int y;
            cin>>y;
            x/=128;
            y%=128;
            x^=y;
            cout<<'!'<<x<<'\n';
    }


    // In the name of Allah
    // There is no power but from God the Almighty
    // No God except Allah
    #include <bits/stdc++.h>
    #define mp make_pair
    #define f1 first
    #define f2 second
    #define pb push_back
    #define pii pair<int ,int>
    #define ios  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    using namespace std;
    const int mox=3e6+9;
    main()
    {

         cout<<'?'<<" ";
         for(int i=0 ; i<100 ; i++)
            cout<<i<<" ";
         cout<<'\n';
         int x;
         cin>>x;
        cout<<'?'<<" ";
         for(int i=0 ; i<100 ; i++)
            cout<<(i*128)<<" ";
             cout<<'\n';
            int y;
            cin>>y;
            x/=128;
            y%=128;
            x^=y;
            cout<<'!'<<x;
    }


    // In the name of Allah
    // There is no power but from God the Almighty
    // No God except Allah
    #include <bits/stdc++.h>
    #define mp make_pair
    #define f1 first
    #define f2 second
    #define pb push_back
    #define pii pair<int ,int>
    #define ios  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    using namespace std;
    const int mox=3e6+9;
    main()
    {

         cout<<'?'<<" ";
         for(int i=0 ; i<100 ; i++)
            cout<<i<<" ";
         cout<<'\n';
         int x;
         cin>>x;
        cout<<'?'<<" ";
         for(int i=1 ; i<=100 ; i++)
            cout<<(i*128)<<" ";
             cout<<'\n';
            int y;
            cin>>y;
            x/=128;
            y%=128;
            x^=y;
            cout<<'!'<<" "<<x;
    }


    // In the name of Allah
    // There is no power but from God the Almighty
    // No God except Allah
    #include <bits/stdc++.h>
    #define mp make_pair
    #define f1 first
    #define f2 second
    #define pb push_back
    #define pii pair<int ,int>
    #define ios  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    using namespace std;
    const int mox=3e6+9;
    main()
    {

         cout<<'?'<<" ";
         for(int i=0 ; i<100 ; i++)
            cout<<i<<" ";
         cout<<'\n';
         int x;
         cin>>x;
        cout<<'?'<<" ";
         for(int i=1 ; i<=100 ; i++)
            cout<<(i*128)<<" ";
             cout<<'\n';
            int y;
            cin>>y;
            x/=64;
            x*=64;
            y%=128;
            x+=y;
            cout<<'!'<<" "<<x;
    }


    // In the name of Allah
    // There is no power but from God the Almighty
    // No God except Allah
    #include <bits/stdc++.h>
    #define mp make_pair
    #define f1 first
    #define f2 second
    #define pb push_back
    #define pii pair<int ,int>
    #define ios  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    using namespace std;
    const int mox=3e6+9;
    main()
    {

         cout<<'?'<<" ";
         for(int i=0 ; i<100 ; i++)
            cout<<i<<" ";
            int x;
         cin>>x;
         cout<<'\n';

        cout<<'?'<<" ";
         for(int i=1 ; i<100 ; i++)
            cout<<(i*128)<<" ";    int y;
            cin>>y;
             cout<<'\n';

            x/=128;
            y%=128;
            x^=y;
            cout<<'!'<<" "<<x<<'\n';
            return 0;
    }


    // In the name of Allah
    // There is no power but from God the Almighty
    // No God except Allah
    #include <bits/stdc++.h>
    #define mp make_pair
    #define f1 first
    #define f2 second
    #define pb push_back
    #define pii pair<int ,int>
    #define ios  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    using namespace std;
    const int mox=3e6+9;
    main()
    {

         cout<<'?'<<" ";
         for(int i=0 ; i<100 ; i++)
            cout<<i<<" ";
         cout<<'\n';
         int x;
         cin>>x;
        cout<<'?'<<" ";
         for(int i=1 ; i<100 ; i++)
            cout<<(i*128)<<" ";
             cout<<'\n';
            int y;
            cin>>y;
            x/=128;
            y%=128;
            x^=y;
            cout<<'!'<<x<<'\n';
    }


#include <set>
#include <map>
#include <deque>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

typedef long long LL;
typedef pair<LL, LL> pLL;
typedef pair<LL, int> pLi;
typedef pair<int, LL> pil;;
typedef pair<int, int> pii;
typedef unsigned long long uLL;

#define lson (rt<<1),L,mid
#define rson (rt<<1|1),mid + 1,R
#define lowbit(x) x&(-x)
#define name2str(name) (#name)
#define bug printf("*********\n")
#define debug(x) cout<<#x"=["<<x<<"]" <<endl
#define FIN freopen("/home/dillonh/CLionProjects/Dillonh/in.txt","r",stdin)
#define IO ios::sync_with_stdio(false),cin.tie(0)

const double eps = 1e-8;
const int mod = 1000000007;
const int maxn = 200000 + 7;
const double pi = acos(-1);
const int inf = 0x3f3f3f3f;
const LL INF = 0x3f3f3f3f3f3f3f3fLL;

int x[105], a[105];
map<int, bool> vis;

int main() {
    srand(time(0));
    printf("? ");
    fflush(stdout);
    for(int i = 1; i <= 14; ++i) {
        a[i] = (1<<i) - 1;
        printf(" %d", a[i]);
        fflush(stdout);
    }
    int tmp = (1<<14) - 1;
    for(int i = 15; i <= 100; ++i) {
        a[i] = rand() % tmp + 1;
        while(vis.count(a[i])) a[i] = rand() % tmp + 1;
        vis[a[i]] = 1;
        printf(" %d", a[i]);
        fflush(stdout);
    }
    printf("\n");
    fflush(stdout);
    int first;
    scanf("%d", &first);
    printf("? ");
    for(int i = 1; i <= 100; ++i) {
        x[i] = first ^ a[i];
        printf(" %d", x[i]);
        fflush(stdout);
    }
    printf("\n");
    int second;
    scanf("%d", &second);
    for(int i = 1; i <= 100; ++i) {
        if((first ^ second) == a[i]) {
            printf("! %d", x[i]);
            return 0;
        }
    }
    return 0;
}


#include <set>
#include <map>
#include <deque>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

typedef long long LL;
typedef pair<LL, LL> pLL;
typedef pair<LL, int> pLi;
typedef pair<int, LL> pil;;
typedef pair<int, int> pii;
typedef unsigned long long uLL;

#define lson (rt<<1),L,mid
#define rson (rt<<1|1),mid + 1,R
#define lowbit(x) x&(-x)
#define name2str(name) (#name)
#define bug printf("*********\n")
#define debug(x) cout<<#x"=["<<x<<"]" <<endl
#define FIN freopen("/home/dillonh/CLionProjects/Dillonh/in.txt","r",stdin)
#define IO ios::sync_with_stdio(false),cin.tie(0)

const double eps = 1e-8;
const int mod = 1000000007;
const int maxn = 200000 + 7;
const double pi = acos(-1);
const int inf = 0x3f3f3f3f;
const LL INF = 0x3f3f3f3f3f3f3f3fLL;

int a[105], b[105];
map<int,bool> vis1, vis2;

int main() {
    srand(time(0));
    int tmp = (1<<14) - 1;
    for(int i = 1; i <= 100; ++i) {
        a[i] = rand() % tmp + 1;
        while(vis1.count(a[i])) a[i] = rand() % tmp + 1;
        vis1[a[i]] = 1;
    }
    for(int i = 1; i <= 100; ++i) {
        b[i] = rand() % tmp + 1;
        while(vis2.count(b[i]) || vis1.count(b[i])) b[i] = rand() % tmp + 1;
        vis2[b[i]] = 1;
    }
    printf("? ");
    fflush(stdout);
    for(int i = 1; i <= 100; ++i) {
        printf(" %d", a[i]);
        fflush(stdout);
    }
    printf("\n");
    fflush(stdout);
    int first;
    scanf("%d", &first);
    printf("? ");
    fflush(stdout);
    for(int i = 1; i <= 100; ++i) {
        printf(" %d", b[i]);
        fflush(stdout);
    }
    printf("\n");
    fflush(stdout);
    int second;
    scanf("%d", &second);
    int x = (first ^ second);
    for(int i = 1; i <= 100; ++i) {
        if(vis2.count(x^a[i])) {
            printf("! %d\n", (x ^ a[i] ^ second));
            fflush(stdout);
            return 0;
        }
    }
    return 0;
}


#include <set>
#include <map>
#include <deque>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

typedef long long LL;
typedef pair<LL, LL> pLL;
typedef pair<LL, int> pLi;
typedef pair<int, LL> pil;;
typedef pair<int, int> pii;

#define lson (rt<<1),L,mid
#define rson (rt<<1|1),mid + 1,R
#define lowbit(x) x&(-x)
#define name2str(name) (#name)
#define bug printf("*********\n")
#define debug(x) cout<<#x"=["<<x<<"]" <<endl
#define FIN freopen("/home/dillonh/CLionProjects/Dillonh/in.txt","r",stdin)
#define IO ios::sync_with_stdio(false),cin.tie(0)

const double eps = 1e-8;
const int mod = 1000000007;
const int maxn = 200000 + 7;
const double pi = acos(-1);
const int inf = 0x3f3f3f3f;
const LL INF = 0x3f3f3f3f3f3f3f3fLL;

int a[105], b[105];
map<int,bool> vis1, vis2;

int main() {
    srand(time(0));
    int tmp = (1<<14) - 1;
    for(int i = 1; i <= 14; ++i) {
        a[i] = (1<<i) - 1;
        vis1[a[i]] = 1;
    }
    for(int i = 15; i <= 100; ++i) {
        a[i] = rand() % tmp + 1;
        while(vis1.count(a[i])) a[i] = rand() % tmp + 1;
        vis1[a[i]] = 1;
    }
    for(int i = 1; i <= 100; ++i) {
        b[i] = rand() % tmp + 1;
        while(vis2.count(b[i]) || vis1.count(b[i])) b[i] = rand() % tmp + 1;
        vis2[b[i]] = 1;
    }
    printf("? ");
    fflush(stdout);
    for(int i = 1; i <= 100; ++i) {
        printf(" %d", a[i]);
        fflush(stdout);
    }
    printf("\n");
    fflush(stdout);
    int first;
    scanf("%d", &first);
    printf("? ");
    fflush(stdout);
    for(int i = 1; i <= 100; ++i) {
        printf(" %d", b[i]);
        fflush(stdout);
    }
    printf("\n");
    fflush(stdout);
    int second;
    scanf("%d", &second);
    int x = (first ^ second);
    for(int i = 1; i <= 100; ++i) {
        if(vis2.count(x^a[i])) {
            printf("! %d\n", (x ^ a[i] ^ second));
            fflush(stdout);
            return 0;
        }
    }
    return 0;
}


#include <set>
#include <map>
#include <deque>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

typedef long long LL;
typedef pair<LL, LL> pLL;
typedef pair<LL, int> pLi;
typedef pair<int, LL> pil;;
typedef pair<int, int> pii;
typedef unsigned long long uLL;

#define lson (rt<<1),L,mid
#define rson (rt<<1|1),mid + 1,R
#define lowbit(x) x&(-x)
#define name2str(name) (#name)
#define bug printf("*********\n")
#define debug(x) cout<<#x"=["<<x<<"]" <<endl
#define FIN freopen("/home/dillonh/CLionProjects/Dillonh/in.txt","r",stdin)
#define IO ios::sync_with_stdio(false),cin.tie(0)

const double eps = 1e-8;
const int mod = 1000000007;
const int maxn = 200000 + 7;
const double pi = acos(-1);
const int inf = 0x3f3f3f3f;
const LL INF = 0x3f3f3f3f3f3f3f3fLL;

int x[105], a[105];
map<int, bool> vis;

int main() {
    srand(time(0));
    printf("? ");
    fflush(stdout);
    for(int i = 1; i <= 14; ++i) {
        a[i] = (1<<i) - 1;
        printf(" %d", a[i]);
        fflush(stdout);
    }
    int tmp = (1<<14) - 1;
    for(int i = 15; i <= 100; ++i) {
        a[i] = rand() % tmp + 1;
        while(vis.count(a[i])) a[i] = rand() % tmp + 1;
        printf(" %d", a[i]);
        fflush(stdout);
    }
    printf("\n");
    fflush(stdout);
    int first;
    scanf("%d", &first);
    printf("? ");
    for(int i = 1; i <= 100; ++i) {
        x[i] = first ^ a[i];
        printf(" %d", x[i]);
        fflush(stdout);
    }
    printf("\n");
    int second;
    scanf("%d", &second);
    for(int i = 1; i <= 100; ++i) {
        if((first ^ second) == a[i]) {
            printf("! %d", x[i]);
            return 0;
        }
    }
    return 0;
}


#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

typedef long long LL;
typedef pair<LL, LL> pLL;
typedef pair<LL, int> pLi;
typedef pair<int, LL> pil;;
typedef pair<int, int> pii;
typedef unsigned long long uLL;

#define lson (rt<<1),L,mid
#define rson (rt<<1|1),mid + 1,R
#define lowbit(x) x&(-x)
#define name2str(name) (#name)
#define bug printf("*********\n")
#define debug(x) cout<<#x"=["<<x<<"]" <<endl
#define FIN freopen("/home/dillonh/CLionProjects/Dillonh/in.txt","r",stdin)
#define IO ios::sync_with_stdio(false),cin.tie(0)

const double eps = 1e-8;
const int mod = 1000000007;
const int maxn = 200000 + 7;
const double pi = acos(-1);
const int inf = 0x3f3f3f3f;
const LL INF = 0x3f3f3f3f3f3f3f3fLL;

int a[105], b[105];
map<int,bool> vis1, vis2;

int main() {
    srand(time(0));
    int tmp = (1<<14) - 1;
    for(int i = 1; i <= 100; ++i) {
        a[i] = rand() % tmp + 1;
        while(vis1.count(a[i])) a[i] = rand() % tmp + 1;
        vis1[a[i]] = 1;
    }
    for(int i = 1; i <= 100; ++i) {
        b[i] = rand() % tmp + 1;
        while(vis2.count(b[i]) || vis1.count(b[i])) b[i] = rand() % tmp + 1;
        vis2[b[i]] = 1;
    }
    printf("? ");
    fflush(stdout);
    for(int i = 1; i <= 100; ++i) {
        printf(" %d", a[i]);
        fflush(stdout);
    }
    printf("\n");
    fflush(stdout);
    int first;
    scanf("%d", &first);
    printf("? ");
    fflush(stdout);
    for(int i = 1; i <= 100; ++i) {
        printf(" %d", b[i]);
        fflush(stdout);
    }
    printf("\n");
    fflush(stdout);
    int second;
    scanf("%d", &second);
    int x = (first ^ second);
    for(int i = 1; i <= 100; ++i) {
        if(vis2.count(x^a[i])) {
            printf("! %d\n", (x ^ a[i] ^ second));
            fflush(stdout);
            return 0;
        }
    }
    return 0;
}


#include <set>
#include <map>
#include <deque>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <random>

using namespace std;

typedef long long LL;
typedef pair<LL, LL> pLL;
typedef pair<LL, int> pLi;
typedef pair<int, LL> pil;;
typedef pair<int, int> pii;

#define lson (rt<<1),L,mid
#define rson (rt<<1|1),mid + 1,R
#define lowbit(x) x&(-x)
#define name2str(name) (#name)
#define bug printf("*********\n")
#define debug(x) cout<<#x"=["<<x<<"]" <<endl
#define FIN freopen("/home/dillonh/CLionProjects/Dillonh/in.txt","r",stdin)
#define IO ios::sync_with_stdio(false),cin.tie(0)

const double eps = 1e-8;
const int mod = 1000000007;
const int maxn = 200000 + 7;
const double pi = acos(-1);
const int inf = 0x3f3f3f3f;
const LL INF = 0x3f3f3f3f3f3f3f3fLL;

mt19937 mt(time(0));
int a[105], b[105];
map<int,bool> vis1, vis2;

int main() {
    int tmp = (1<<14) - 1;
    for(int i = 1; i <= 14; ++i) {
        a[i] = (1<<i) - 1;
        vis1[a[i]] = 1;
    }
    for(int i = 15; i <= 100; ++i) {
        a[i] = mt() % tmp + 1;
        while(vis1.count(a[i])) a[i] = mt() % tmp + 1;
        vis1[a[i]] = 1;
    }
    for(int i = 1; i <= 100; ++i) {
        b[i] = mt() % tmp + 1;
        while(vis2.count(b[i]) || vis1.count(b[i])) b[i] = mt() % tmp + 1;
        vis2[b[i]] = 1;
    }
    printf("? ");
    fflush(stdout);
    for(int i = 1; i <= 100; ++i) {
        printf(" %d", a[i]);
        fflush(stdout);
    }
    printf("\n");
    fflush(stdout);
    int first;
    scanf("%d", &first);
    printf("? ");
    fflush(stdout);
    for(int i = 1; i <= 100; ++i) {
        printf(" %d", b[i]);
        fflush(stdout);
    }
    printf("\n");
    fflush(stdout);
    int second;
    scanf("%d", &second);
    int x = (first ^ second);
    for(int i = 1; i <= 100; ++i) {
        if(vis2.count(x^a[i])) {
            printf("! %d\n", (x ^ a[i] ^ second));
            fflush(stdout);
            return 0;
        }
    }
    return 0;
}


#include <set>
#include <map>
#include <deque>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <random>

using namespace std;

typedef long long LL;
typedef pair<LL, LL> pLL;
typedef pair<LL, int> pLi;
typedef pair<int, LL> pil;;
typedef pair<int, int> pii;

#define lson (rt<<1),L,mid
#define rson (rt<<1|1),mid + 1,R
#define lowbit(x) x&(-x)
#define name2str(name) (#name)
#define debug(x) cout<<#x"=["<<x<<"]" <<endl
#define IO ios::sync_with_stdio(false),cin.tie(0)

const double eps = 1e-8;
const int mod = 1000000007;
const int maxn = 200000 + 7;
const double pi = acos(-1);
const int inf = 0x3f3f3f3f;
const LL INF = 0x3f3f3f3f3f3f3f3fLL;

mt19937 mt(time(0));
int a[105], b[105];
map<int,bool> vis1, vis2;

int main() {
    int tmp = (1<<14) - 1;
    for(int i = 1; i <= 14; ++i) {
        a[i] = (1<<i) - 1;
        vis1[a[i]] = 1;
    }
    for(int i = 15; i <= 100; ++i) {
        a[i] = mt() % tmp + 1;
        while(vis1.count(a[i])) a[i] = mt() % tmp + 1;
        vis1[a[i]] = 1;
    }
    for(int i = 1; i <= 100; ++i) {
        b[i] = mt() % tmp + 1;
        while(vis2.count(b[i]) || vis1.count(b[i])) b[i] = mt() % tmp + 1;
        vis2[b[i]] = 1;
    }
    printf("? ");
    fflush(stdout);
    for(int i = 1; i <= 100; ++i) {
        printf(" %d", a[i]);
        fflush(stdout);
    }
    printf("\n");
    fflush(stdout);
    int first;
    scanf("%d", &first);
    printf("? ");
    fflush(stdout);
    for(int i = 1; i <= 100; ++i) {
        printf(" %d", b[i]);
        fflush(stdout);
    }
    printf("\n");
    fflush(stdout);
    int second;
    scanf("%d", &second);
    int x = (first ^ second);
    for(int i = 1; i <= 100; ++i) {
        if(vis2.count(x^a[i])) {
            printf("! %d\n", (x ^ a[i] ^ second));
            fflush(stdout);
            return 0;
        }
    }
    return 0;
}


#include <set>
#include <map>
#include <deque>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

typedef long long LL;
typedef pair<LL, LL> pLL;
typedef pair<LL, int> pLi;
typedef pair<int, LL> pil;;
typedef pair<int, int> pii;
typedef unsigned long long uLL;

#define lson (rt<<1),L,mid
#define rson (rt<<1|1),mid + 1,R
#define lowbit(x) x&(-x)
#define name2str(name) (#name)
#define bug printf("*********\n")
#define debug(x) cout<<#x"=["<<x<<"]" <<endl
#define FIN freopen("/home/dillonh/CLionProjects/Dillonh/in.txt","r",stdin)
#define IO ios::sync_with_stdio(false),cin.tie(0)

const double eps = 1e-8;
const int mod = 1000000007;
const int maxn = 200000 + 7;
const double pi = acos(-1);
const int inf = 0x3f3f3f3f;
const LL INF = 0x3f3f3f3f3f3f3f3fLL;

int a[105], b[105];
map<int,bool> vis1, vis2;

int main() {
    srand(time(0));
    int tmp = (1<<14) - 1;
    for(int i = 1; i <= 14; ++i) {
        a[i] = (1<<i) - 1;
        vis1[a[i]] = 1;
    }
    for(int i = 15; i <= 100; ++i) {
        a[i] = rand() % tmp + 1;
        while(vis1.count(a[i])) a[i] = rand() % tmp + 1;
        vis1[a[i]] = 1;
    }
    for(int i = 1; i <= 100; ++i) {
        b[i] = rand() % tmp + 1;
        while(vis2.count(b[i]) || vis1.count(b[i])) b[i] = rand() % tmp + 1;
        vis2[b[i]] = 1;
    }
    printf("? ");
    fflush(stdout);
    for(int i = 1; i <= 100; ++i) {
        printf(" %d", a[i]);
        fflush(stdout);
    }
    printf("\n");
    fflush(stdout);
    int first;
    scanf("%d", &first);
    printf("? ");
    fflush(stdout);
    for(int i = 1; i <= 100; ++i) {
        printf(" %d", b[i]);
        fflush(stdout);
    }
    printf("\n");
    fflush(stdout);
    int second;
    scanf("%d", &second);
    int x = (first ^ second);
    for(int i = 1; i <= 100; ++i) {
        if(vis2.count(x^a[i])) {
            printf("! %d\n", (x ^ a[i] ^ second));
            fflush(stdout);
            return 0;
        }
    }
    return 0;
}


#include <set>
#include <map>
#include <deque>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

typedef long long LL;
typedef pair<LL, LL> pLL;
typedef pair<LL, int> pLi;
typedef pair<int, LL> pil;;
typedef pair<int, int> pii;
typedef unsigned long long uLL;

#define lson (rt<<1),L,mid
#define rson (rt<<1|1),mid + 1,R
#define lowbit(x) x&(-x)
#define name2str(name) (#name)
#define bug printf("*********\n")
#define debug(x) cout<<#x"=["<<x<<"]" <<endl
#define FIN freopen("/home/dillonh/CLionProjects/Dillonh/in.txt","r",stdin)
#define IO ios::sync_with_stdio(false),cin.tie(0)

const double eps = 1e-8;
const int mod = 1000000007;
const int maxn = 200000 + 7;
const double pi = acos(-1);
const int inf = 0x3f3f3f3f;
const LL INF = 0x3f3f3f3f3f3f3f3fLL;

int x[105], a[105];
map<int, bool> vis;

int main() {
    srand(time(0));
    printf("? ");
    fflush(stdout);
    int tmp = (1<<14) - 1;
    for(int i = 1; i <= 100; ++i) {
        a[i] = rand() % tmp + 1;
        while(vis.count(a[i])) a[i] = rand() % tmp + 1;
        vis[a[i]] = 1;
        printf(" %d", a[i]);
        fflush(stdout);
    }
    printf("\n");
    fflush(stdout);
    int first;
    scanf("%d", &first);
    int flag = 0;
    if(vis.count(first)) flag = 1;
    printf("? ");
    for(int i = 1; i <= 100; ++i) {
        x[i] = (first ^ a[i]);
        printf(" %d", x[i]);
        fflush(stdout);
    }
    printf("\n");
    int second;
    scanf("%d", &second);
    if(vis.count(second) && flag == 1) {
        printf("! 0\n");
        fflush(stdout);
        return 0;
    }
    for(int i = 1; i <= 100; ++i) {
        if(vis.count((second ^ a[i]))) {
            int tmp = (second ^ a[i]);
            printf("! %d\n", (tmp ^ first));
            fflush(stdout);
            return 0;
        }
    }
    return 0;
}


#include <set>
#include <map>
#include <deque>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <random>

using namespace std;

typedef long long LL;
typedef pair<LL, int> pLi;
typedef pair<int, LL> pil;;
typedef pair<int, int> pii;

#define lson (rt<<1),L,mid
#define rson (rt<<1|1),mid + 1,R
#define lowbit(x) x&(-x)
#define name2str(name) (#name)
#define bug printf("*********\n")
#define debug(x) cout<<#x"=["<<x<<"]" <<endl
#define FIN freopen("/home/dillonh/CLionProjects/Dillonh/in.txt","r",stdin)
#define IO ios::sync_with_stdio(false),cin.tie(0)

const double eps = 1e-8;
const int mod = 1000000007;
const int maxn = 200000 + 7;
const double pi = acos(-1);
const int inf = 0x3f3f3f3f;
const LL INF = 0x3f3f3f3f3f3f3f3fLL;

mt19937 mt(time(0));
int a[105], b[105];
map<int,bool> vis1, vis2;

int main() {
    int tmp = (1<<14) - 1;
    for(int i = 1; i <= 14; ++i) {
        a[i] = (1<<i) - 1;
        vis1[a[i]] = 1;
    }
    for(int i = 15; i <= 100; ++i) {
        a[i] = mt() % tmp + 1;
        while(vis1.count(a[i])) a[i] = mt() % tmp + 1;
        vis1[a[i]] = 1;
    }
    for(int i = 1; i <= 100; ++i) {
        b[i] = mt() % tmp + 1;
        while(vis2.count(b[i]) || vis1.count(b[i])) b[i] = mt() % tmp + 1;
        vis2[b[i]] = 1;
    }
    printf("? ");
    fflush(stdout);
    for(int i = 1; i <= 100; ++i) {
        printf(" %d", a[i]);
        fflush(stdout);
    }
    printf("\n");
    fflush(stdout);
    int first;
    scanf("%d", &first);
    printf("? ");
    fflush(stdout);
    for(int i = 1; i <= 100; ++i) {
        printf(" %d", b[i]);
        fflush(stdout);
    }
    printf("\n");
    fflush(stdout);
    int second;
    scanf("%d", &second);
    int x = (first ^ second);
    for(int i = 1; i <= 100; ++i) {
        if(vis2.count(x^a[i])) {
            printf("! %d\n", (x ^ a[i] ^ second));
            fflush(stdout);
            return 0;
        }
    }
    return 0;
}


#include <set>
#include <map>
#include <deque>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <random>

using namespace std;

typedef long long LL;
typedef pair<LL, LL> pLL;
typedef pair<LL, int> pLi;
typedef pair<int, LL> pil;;
typedef pair<int, int> pii;

#define lson (rt<<1),L,mid
#define rson (rt<<1|1),mid + 1,R
#define lowbit(x) x&(-x)
#define name2str(name) (#name)
#define bug printf("*********\n")
#define debug(x) cout<<#x"=["<<x<<"]" <<endl
#define IO ios::sync_with_stdio(false),cin.tie(0)

const double eps = 1e-8;
const int mod = 1000000007;
const int maxn = 200000 + 7;
const double pi = acos(-1);
const int inf = 0x3f3f3f3f;
const LL INF = 0x3f3f3f3f3f3f3f3fLL;

mt19937 mt(time(0));
int a[105], b[105];
map<int,bool> vis1, vis2;

int main() {
    int tmp = (1<<14) - 1;
    for(int i = 1; i <= 14; ++i) {
        a[i] = (1<<i) - 1;
        vis1[a[i]] = 1;
    }
    for(int i = 15; i <= 100; ++i) {
        a[i] = mt() % tmp + 1;
        while(vis1.count(a[i])) a[i] = mt() % tmp + 1;
        vis1[a[i]] = 1;
    }
    for(int i = 1; i <= 100; ++i) {
        b[i] = mt() % tmp + 1;
        while(vis2.count(b[i]) || vis1.count(b[i])) b[i] = mt() % tmp + 1;
        vis2[b[i]] = 1;
    }
    printf("? ");
    fflush(stdout);
    for(int i = 1; i <= 100; ++i) {
        printf(" %d", a[i]);
        fflush(stdout);
    }
    printf("\n");
    fflush(stdout);
    int first;
    scanf("%d", &first);
    printf("? ");
    fflush(stdout);
    for(int i = 1; i <= 100; ++i) {
        printf(" %d", b[i]);
        fflush(stdout);
    }
    printf("\n");
    fflush(stdout);
    int second;
    scanf("%d", &second);
    int x = (first ^ second);
    for(int i = 1; i <= 100; ++i) {
        if(vis2.count(x^a[i])) {
            printf("! %d\n", (x ^ a[i] ^ second));
            fflush(stdout);
            return 0;
        }
    }
    return 0;
}


#include <iostream>
#include <cmath>

using namespace std;

int main() {
	cout << 1 << endl;
	cout.flush();
	int x;
	cin >> x;
	cout << (x ^ 1);
	cout.flush();
	return 0;
}


#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main() {
	int num = 1, x, y;
	vector <int> a(100, 0), b(100, 0);
	cout << "? ";
	for (int i = 0; i < 100; ++i) {
		cout << num << " ";
		a[i] = num;
		num += 2;
	}
	cout << endl;
	cout.flush();
	cin >> x;
	num = 0;
	cout << " ?";
	for (int i = 0; i < 100; ++i) {
		cout << num << " ";
		b[i] = num;
		num += 2;
	}
	cout << endl;
	cout.flush();
	cin >> y;
	for (int i = 0; i < 100; ++i)
		for (int j = 0; j < 100; ++j)
			if (abs(a[i] - b[j]) == (x ^ y)) {
				cout << "! " << (a[i] ^ x) << endl;
				cout.flush();
				return 0;
			}
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    cout << "?";
    for(int i = 1; i <= 100; i++)
        cout << " " << i;
    cout << endl;
    cout.flush();
    int res1;
    cin >> res1;
    cout << "?";
    for(int i = 1; i <= 100; i++)
        cout << " " << (i << 7);
    cout << endl;
    cout.flush();
    int res2;
    cin >> res2;
    int x = 0;
    x |= (res1 & (((1 << 7) - 1) << 7));
    x |= (res2 & ((1 << 7) - 1));
    cout << "! " << x << endl;
    cout.flush();
    return 0;
}


#include <iostream>
#include <cmath>

using namespace std;

int main() {
	cout << "? " << 1 << endl;
	cout.flush();
	int x;
	cin >> x;
	cout << "! " << (x ^ 1);
	cout.flush();
	return 0;
}


#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main() {
	int num = 1, x, y;
	vector <int> a(100, 0), b(100, 0);
	cout << "? ";
	for (int i = 0; i < 100; ++i) {
		cout << num << " ";
		a[i] = num;
		num += 2;
	}
	cout << endl;
	cout.flush();
	cin >> x;
	num = 0;
	cout << " ?";
	for (int i = 0; i < 100; ++i) {
		cout << num << " ";
		b[i] = num;
		num += 2;
	}
	cout << endl;
	cout.flush();
	cin >> y;
	for (int i = 0; i < 100; ++i)
		for (int j = 0; j < 100; ++j)
			if ((a[i] ^ b[j]) == (x ^ y)) {
				cout << "! " << (a[i] ^ x) << endl;
				cout.flush();
				return 0;
			}
	return 0;
}


#include <iostream>

using namespace std;

int main() {
	int x, y, ans = 0;
	cout << "? ";
	for (int i = 1; i <= 100; ++i)
		cout << i << " ";
	cout << endl;
	cout.flush();
	cin >> x;
	for (int i = 1; i <= 100; ++i)
		cout << (i << 7) << " ";
	cout << endl;
	cout.flush();
	cin >> y;
	ans |= (x && (((1 << 7) - 1) << 7));
	ans |= (y && ((1 << 7) - 1));
	cout << "! " << ans;
	cout.flush();
	return 0;
}