#include "bits/stdc++.h" using namespace std; #define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i)) #define rep(i,j) FOR(i,0,j) #define each(x,y) for(auto &(x):(y)) #define mp make_pair #define all(x) (x).begin(),(x).end() #define debug(x) cout<<#x<<": "<<(x)< pii; typedef vector vi; typedef vector vll; int main(){ vi flag(30); int N; cin >> N; rep(i, N){ int a; scanf("%d", &a); rep(j, 30)flag[j]|=a >> j & 1 ? 1 : 2; } int ans = 0; rep(j, 30)if(flag[j] == 3)ans |= 1 << j; cout << ans << endl; }