#include using namespace std; using ll = unsigned long long; #define all(x) begin(x), end(x) #define rep(i,a,b) for (auto i = a; i < (b); ++i) #define vi vector #define pii pair #define W(x) cerr << #x << ": " << (x) << "\n"; constexpr int BITS = 64; int main () { cin.tie(0)->sync_with_stdio(0); array bits{}; int n; vector nums; cin >> n; rep(i,0,n) { ll x; cin >>x; for (int i = 0; i < BITS; ++i) { if (x & (1ll << i)) ++bits[i]; nums.push_back(x); } } // const char *sep = ""; // for (auto x : bits) { // cerr << sep << x; // sep = ", "; // } // cerr << endl; ll acc = 0ll; for (int i = 0; i < BITS; ++i) { if (bits[i]) acc |= (1ll << i); if (i + 1 < BITS) bits[i+1] += bits[i] / 2; } cout << acc << endl; return 0; }