#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;

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

    int n;
    cin >> n;
    
    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;
}