#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) (x).begin(), (x).end()
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
  #define debug(x) cerr << #x " => " << x << endl
#else
  #define debug(x) 0
#endif
using lint = long long;
constexpr int    INF  = 1 << 30;
constexpr lint   INFL = 1LL << 62;
constexpr int    MOD  = (int)1e9 + 7;
constexpr double EPS  = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

class BitMatrix {
  constexpr static int maxh = 62, maxw = 100005;
  bitset<maxw> mat_[maxh];
  int h_, w_;

  public:
  BitMatrix(void) {}
  BitMatrix(const int height, const int width, const bool initial = false) { init(height, width, initial); }
  void init(const int height, const int width, const bool initial = false) {
    h_ = height, w_ = width;
    if (initial) for (int i = 0, val = (1 << w_) - 1; i < h_; ++i) mat_[i] = val;
  }
  const bitset<maxw> &operator[](size_t i) const {
    return mat_[i];
  }
  bitset<maxw> &operator[](size_t i) { return mat_[i]; }
  int height(void) const { return h_; }
  int width(void) const { return w_; }
  friend ostream &operator<<(ostream &os, BitMatrix &mat) {
    for (int i = 0; i < mat.h_; ++i) {
      os << "[ ";
      for (int j = 0; j < mat.w_; ++j) {
        os << mat[i][j] << (j == mat.w_ - 1 ? " ]\n" : ", ");
      }
    }
    return os;
  }
};

class GaussJordanBit {
  BitMatrix mat_;
  int h_, w_, rank_;

  public:
  GaussJordanBit(const BitMatrix &mat) { init(mat); }
  GaussJordanBit(const BitMatrix &mat, const vector<bool> &v) {
    const int h = mat.height(), w = mat.width();
    BitMatrix exmat(h, w + 1);
    for (int i = 0; i < h; ++i) {
      for (int j = 0; j < w; ++j) exmat[i][j] = mat[i][j];
      exmat[i][w] = v[i];
    }
    init(exmat, true);
  }
  void init(const BitMatrix &mat, const bool extended = false) {
    h_ = mat.height(), w_ = mat.width(), mat_ = mat, rank_ = 0;
    vector<bool> checked(60);
    for (int col = 0, rcol = w_ - extended; col < rcol; ++col) {
      int pivot = -1;
      for (int row = 0; row < h_; ++row) {
        if (checked[row]) continue;
        if (mat_[row][col]) { pivot = row; break; }
      }
      if (pivot == -1) continue;
      // swap(mat_[pivot], mat_[rank_]);
      for (int row = 0; row < h_; ++row) {
        if (row != pivot && mat_[row][col]) mat_[row] ^= mat_[pivot];
      }
      checked[pivot] = true;
      ++rank_;
    }
  }
  vector<int> solution(void) const {
    for (int row = rank_; row < h_; ++row) {
      if (mat_[row][w_]) return vector<int>();
    }
    vector<int> ret(w_ - 1);
    for (int i = 0; i < rank_; ++i) ret[i] = mat_[i][w_ - 1];
    return ret;
  }
  BitMatrix result(void) { return mat_; }
  int rank(void) { return rank_; }
};

int main(void) {
  int n;
  cin >> n;
  vector<lint> a(n);
  rep (i, n) cin >> a[i];
  vector<int> dig(60, -1);
  rep (i, n) {
    rep (j, 60) {
      if (a[i] & (1LL << j)) dig[j] = !dig[j];
    }
  }
  lint sum = 0;
  vector<bool> r(60);
  rep (i, 60) {
    if (dig[i] == 0) {
      sum += (1LL << i);
    } else if (dig[i] == 1) {
      r[59 - i] = true;
    }
  }
  BitMatrix mat(60, n);
  rep (i, 60) {
    if (dig[59 - i] <= 0) continue;
    rep (j, n) {
      mat[i][j] = a[j] & (1LL << (59 - i));
    }
  }
  GaussJordanBit gj(mat, r);
  auto ret = gj.result();
  rep (i, 60) {
    if (dig[59 - i] <= 0) continue;
    bool check = false;
    if (!ret[i][n]) check = true;
    rep (j, n) {
      if (ret[i][j]) check = true;
    }
    if (check) sum += (1LL << (59 - i)) * 2;
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 4096