//
// Created by maze on 2019/09/15.
//

#include <bits/stdc++.h>
using namespace std;

#define INF_LL (int64)1e18
#define INF (int64)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a); i < (b); i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int32_t;
using int64 = int64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

template<int DIGITS = 30, int NODE_NUM = 1000000>
class BinaryTrie {
public:
    using value_type = std::int64_t;
    using size_type = std::int64_t;

    struct Node {
        bool v;
        size_type ch[2], size;
        Node () : v(0), size(0) {
            ch[0] = ch[1] = -1;
        }
    };
private:
    std::vector<Node> node;
    size_type size_;;

public:
    BinaryTrie() {
        node.reserve(NODE_NUM);
        node.push_back(Node());
    }

    inline static size_type child_key(const value_type& v, size_type k) {
        return (v >> (DIGITS - k - 1)) & 1;
    }

    void insert(const value_type& v, size_type num = 1, size_type k = 0, size_type idx = 0) {
        node[idx].size += num;
        if (k == DIGITS) { size_ += num; return; }
        size_type nxt = child_key(v, k);
        if (node[idx].ch[nxt] == -1) {
            node[idx].ch[nxt] = node.size();
            node.push_back(Node());
        }
        insert(v, num, k+1, node[idx].ch[nxt]);
    }

    bool erase(const value_type& v, size_type num = 1, size_type k = 0, size_type idx = 0) {
        if (k == DIGITS) {
            node[idx].size -= num;
            size_ -= num;
            return true;
        }
        size_type nxt = child_key(v, k);
        if (node[idx].ch[nxt] == -1) {
            return false;
        } else if (erase(v, num, k+1, node[idx].ch[nxt])) {
            node[idx].size -= num;
        }
    }

    const size_type size() { return size_; }

    size_type count(const value_type& v, size_type k = 0, size_type idx = 0) {
        if (k == DIGITS) return node[idx].size;
        size_type nxt = (v >> (DIGITS - k - 1)) & 1;
        if (node[idx].ch[nxt] == -1) return 0;
        return count(v, k+1, node[idx].ch[nxt]);
    }

    value_type min_element(const value_type& x = 0, value_type now = 0, size_type k = 0, size_type idx = 0) { // v xor xが最小となるようなv xor xを返す
        if (k == DIGITS)  return now;
        size_type nxt = child_key(x, k);
        if (node[idx].ch[nxt] != -1 && node[node[idx].ch[nxt]].size > 0) {
            return min_element(x, now, k+1, node[idx].ch[nxt]);
        } else if (node[idx].ch[nxt ^ 1] != -1 && node[node[idx].ch[nxt^1]].size > 0) {
            return min_element(x, now | (1LL << (DIGITS - k - 1)), k+1, node[idx].ch[nxt ^ 1]);
        } else {
            return -1;
        }
    }

    value_type max_element(const value_type& x = 0) { // v xor vが最大となるようなv xor xを返す

    }
};

template<::std::size_t Column>
class BinaryMatrix {
public:
    using size_type = ::std::size_t;
    using value_type = ::std::uint64_t;
    using Row = ::std::bitset<Column>;
    using Mat = ::std::vector<Row>;

private:
    size_type R, C;
    Mat A;

    void add_row_to_another(size_type r1, size_type r2){ // Row(r1) += Row(r2)
        A[r1] = A[r1] ^ A[r2];
    }


public:
    BinaryMatrix() {}
    BinaryMatrix(size_type R_, size_type C_ = Column) : R(R_), C(C_), A(Mat(R_)) {}
    BinaryMatrix(const Mat& A_) : R(A_.size()), C(A_[0].size()), A(A_) {}
    BinaryMatrix(const Mat&& A_) : R(A_.size()), C(A_[0].size()), A(A_) {}
    BinaryMatrix(const BinaryMatrix& m) : R(m.R), C(m.C), A(m.A) {}
    BinaryMatrix(const BinaryMatrix&& m) : R(m.R), C(m.C), A(m.A) {}

    BinaryMatrix &operator=(const BinaryMatrix &m){
        R = m.R; C = m.C; A = m.A;
        return *this;
    }
    BinaryMatrix &operator=(const BinaryMatrix &&m){
        R = m.R; C = m.C; A = m.A;
        return *this;
    }
    static BinaryMatrix I(const size_type N){
        BinaryMatrix m(N, N);
        for(size_type i = 0;i < N;i++) m[i][i] = 1;
        return m;
    }

    const Row& operator[](size_type k) const& { return A.at(k); }
    Row& operator[](size_type k) & { return A.at(k); }
    Row operator[](size_type k) const&& { return ::std::move(A.at(k)); }

    size_type row() const { return R; } // the number of rows
    size_type column() const { return C; }

    BinaryMatrix& operator+=(const BinaryMatrix &B){
        assert(column() == B.column() && row() == B.row());
        for(size_type i = 0;i < R;i++)
            (*this)[i] ^= B[i];
        return *this;
    }

    BinaryMatrix& operator-=(const BinaryMatrix &B){
        assert(column() == B.column() && row() == B.row());
        for(size_type i = 0;i < R;i++)
            (*this)[i] ^= B[i];
        return *this;
    }

    BinaryMatrix& operator*=(const BinaryMatrix &B){
        assert(column() == B.row());
        BinaryMatrix M(R, B.column());
        for(size_type i = 0;i < R;i++) {
            for(size_type j = 0;j < B.column();j++) {
                M[i][j] = 0;
                for(size_type k = 0;k < C;k++) {
                    M[i][j] ^= ((*this)[i][k] & B[k][j]);
                }
            }
        }
        swap(M, *this);
        return *this;
    }

    void gaussian_elimination() {
        size_type last_row = 0;
        for (int i = 59; i >= 0 && last_row < R; i--) {
            for (size_type j = last_row; j < R; j++) {
                if (A[j][i]) {
                    swap(A[j], A[last_row]);
                    break;
                }
            }

            for (size_type j = 0; j < R; j++) {
                if (last_row == j) continue;
                if (A[last_row][i] && A[j][i]) {
                    add_row_to_another(j, last_row);
                }
            }
            if (A[last_row][i]) last_row++;
        }
    }

    size_type rank() {
        Mat tmp = A;
        gaussian_elimination();
        swap(tmp, A);
        for (size_type i = 0; i < R; i++) {
            size_type cnt = 0;
            for (size_type j = 0; j < C; j++) {
                if (tmp[i][j]) cnt++;
            }
            if (cnt == 0) return i;
        }
        return R;
    }

    // if you use this method, you must call gaussian_elimination before.
    bool can_construct_x(const Row& x) {
        Row now;
        for (size_type i = 0; i < R; i++) {
            for (size_type j = 0; j < C; j++) {
                if (x[j] == now[j] && A[i][j]) break;
                if (x[j] != now[j] && A[i][j]) {
                    now ^= A[i];
                    break;
                }
            }
        }
        return now == x;
    }
};


int main(void) {
    int64 N;
    cin >> N;
    vector<int64> A(N);
    int64 all_xor = 0;
    vector<int64> cnt(60, 0);
    int64 res = 0;
    REP(i, N) {
        cin >> A[i];
        REP(j, 60) {
            if (A[i] >> j & 1) cnt[j]++;
        }
    }
    vector<bitset<60>> v(N);
    REP(i, 60) {
        if (cnt[i] % 2) {
            res += 1LL << i;
            REP(j, N) {
                if (A[j] >> i & 1) {
                    A[j] ^= 1LL << i;
                }
            }
        }
    }
    REP(i, N) {
        v[i] = bitset<60>(A[i]);
    }
    BinaryMatrix<60> bm(v);
    bm.gaussian_elimination();
    int64 sum = 0;
    REP(i, N) {
        REP(j, 60) {
            sum ^= ((int64)bm[i][j] << j);
        }
    }
    cout << res + sum*2 << endl;
}


Measured memory_bytes: 2560