#include using namespace std; int N; int A[1000005]; /* int dfs(int bit, int l, int r){ if(bit < 0){ for(int i = l; i < r; i++){ } } int ll = l; int rr = r - 1; while(1){ while(ll < N && (A[ll] & (1 << bit)) == 0) ll++; while(rr >= 0 && (A[rr] & (1 << bit)) != 1) rr--; if(ll >= rr) break; swap(A[ll], A[rr]); ll++; rr--; } return min(dfs(bit - 1, l, ll), dfs(bit - 1, rr + 1, r); } */ int cnt[100][2]; int main(){ cin >> N; for(int i = 0; i < N; i++){ cin >> A[i]; } int ans = 0; for(int i = 0; i < 32; i++){ cnt[i][0] = 0; cnt[i][1] = 0; for(int j = 0; j < N; j++){ if((A[j] & (1 << i))){ cnt[i][0]++; }else{ cnt[i][1]++; } } if(cnt[i][0] != 0 && cnt[i][1] != 0){ ans |= 1 << i; } } cout << ans << endl; }