#include <bits/stdc++.h>

using namespace std;

#define int ll
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef pair<int, int> pi;
typedef vector<pi> vp;
typedef vector<bool> vb;

vector<vi> s;
vi f(int x){
    vi sol;
    for (int i = 0; i < 50; ++i){
        sol.push_back(x % 2);
        x /= 2;
    }
    
    reverse(sol.begin(), sol.end());
    
    return sol;
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cerr.tie(nullptr);

    int n;
    cin >> n;
    
    if (n > 8)
        while(1);
    return 0;
    
    vi a(n);
    for (auto& i : a)
        cin >> i;
    
    int c = 0, d = a[0];
    for (auto& i : a){
        c = (c ^ i);
        d = (d & i);
    }
    
    if (c && d)
        return cout << "0\n", 0;
    
    int cnt = 0;
    for (auto& i : a){
        if (!i){
            i = 1;
            ++cnt;
        }
    }
    
    for (auto& i : a)
        s.push_back(f(i));
    
    
}