#include "bits/stdc++.h" #define int long long #define dick vector #define full(a) a.begin(), a.end() using namespace std; using vi = vector; using vvi = vector; using pii = pair; #define V vector #define Vi = V #define all(a) a.begin(), a.end() #define forn(i, n) for(int i=0; i> n >> a >> b; cout << len(n) << ' ' << len(b) << ' ' << len(a) << '\n'; if(n != a*b) return false; if(len(a) != len(b) || len(n) != len(a)*2) return false; if(a%10 == 0 && b % 10 == 0) return false; array n_d = {0}, a_d = {0}; while(n) { n_d[n%10]++; n/= 10; } while(a) { a_d[a%10]++; a/=10; } while(b) { a_d[b%10]++; b/=10; } for(int i=0; i<10; i++) if(a_d[i] != n_d[i]) return false; return true; } double dist(int x, int y) { return sqrt(x*x*1.0 + y*y + 0.0); } double dist2(double x, double y) { return x*x*1.0 + y*y + 0.0; } void solveA() { vector> a(3); for(int i = 0; i<3; i++) { cin>>a[i].first>>a[i].second; } double mn = INT_MAX, mi = -1; for(int i = 0; i<3; i++) { pii other1 = a[(i+1) % 3]; pii other2= a[(i+2) % 3]; if(dist(other1.first - a[i].first, other2.second - a[i].second) < mn) { mn = dist(other1.first - a[i].first, other2.second - a[i].second); mi = i; } if(dist(other2.first - a[i].first, other1.second - a[i].second) < mn) { mn = dist(other2.first - a[i].first, other1.second - a[i].second); mi = i; } } cout<> a(3); for(int i = 0; i<3; i++) { cin>>a[i].first>>a[i].second; } double mn = INT_MAX, mi = -1; int precision = 10000; for(int i = -100 * precision; i <= 100*precision; i++) { for(int j = -100 * precision; i<= 100 * precision; i++) { double x = i*1.0/precision; double y = j*1.0/precision; for(int i = 0; i<3; i++) { pii other1 = a[(i+1) % 3]; pii other2= a[(i+2) % 3]; if(dotP(other1.first - x, other1.second - y, other2.first - x, other2.second - y) != 0) continue; if(dist2(x - a[i].first, y - a[i].second) < mn) { mn = dist2(x - a[i].first, y - a[i].second); mi = i; } } } } cout<>n>>q; dick a(n); for(int i =0 ;i < n ;i ++){ cin>>a[i]; } dick b(n); dick c(n); for(int i = 1;i < n ;i ++){ if( a[i] < a[i-1] )b[i] =-1; } for(int i = 1 ;i < n;i++){ c[i] = c[i- 1] + b[i]; } while(q--){ int r, l; cin>>r>> l; r--;l --; if(c[r] - c[l] != 0 ){ cout<< "NO\n"; } else cout<< "YES\n"; } return; } void solveS() { int n; cin >> n; array bs = {0}; forn(i, n) { int a; cin >> a; for(int j=0; a; j++, a/=2) { bs[j] += a&1; } } unsigned long long res = 0; for(int j=0; j<64; j++) { if(bs[j]) { res |= ((unsigned long long)1) << j; } bs[j+1] += bs[j] / 2; } cout << res; } signed main() { solveS(); // solveA1(); return 0; }