#include <bits/stdc++.h>
#define loop(n) for (int ngtkana_is_genius = 0; ngtkana_is_genius < int(n); ngtkana_is_genius++)
#define rep(i, begin, end) for(int i = int(begin); i < int(end); i++)
#define all(v) v.begin(), v.end()
#define lint long long
auto cmn = [](auto& a, auto b){if (a > b) {a = b; return true;} return false;};
auto cmx = [](auto& a, auto b){if (a < b) {a = b; return true;} return false;};
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail){
  std::cerr << " " << head;
  debug_impl(tail...);
}
#define debug(...)\
  std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
  debug_impl(__VA_ARGS__);\
  std::cerr << std::noboolalpha;

template <typename T>
std::istream& operator>> (std::istream& is, std::vector<T>& v) {
  for (auto & x : v) is >> x;
  return is;
}

template <typename T>
std::ostream& operator<< (std::ostream& os, const std::vector<T>& v) {
  auto n = v.size();
  os << "{";
  for (size_t i = 0; i < n; i++)
    {os << (i > 0 ? "," : "") << v.at(i);}
  return os << "}";
}

class gauss_jordan {
  const int h, w;
  int rk;
  std::vector<bool> ckd;
  std::vector<int> p, a;
  void init () {
    for (int j = 0; j < w; j++) {
      for (int pvt = 0; pvt < h; pvt++) {
        if (ckd[pvt]) continue;
        if (a[j] >> pvt & 1) {
          ckd[pvt] = true; rk++;
          int comb = a[j] ^ 1 << pvt;
          for (int i = 0; i < h; i++) if (p[i] >> pvt & 1) p[i] ^= comb;
          for (int k = j; k < w; k++) if (a[k] >> pvt & 1) a[k] ^= comb;
          break;
        }
      }
    }
  }
  int transform (int y) const {
    int z = 0;
    for (int i = 0; i < h; i++) {
      if (y >> i & 1) z |= p[i];
    }
    return z;
  }
  public:
    gauss_jordan (
        std::vector<int> a,
        int h
      ) :
      h(h), w(a.size()), rk(0),
      ckd(h, false),
      p([&]{
        std::vector<int> p(h); 
        for (int i = 0, x = 1; i < h; i++, x *= 2) p[i] = x;
        return p;
      }()),
      a(a)
      {
        init();
      }
    int rank () const {return rk;}
    int kernel () const {return w - rk;}
    int image () const {return h - rk;}
    bool solvable (int y) const {
      assert (!(y >> h));
      int acm = accumulate(a.begin(), a.end(), 0, [](int x, int y){return x | y;});
      int z = transform(y);
      return !(~acm & z);
    }
};

int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int n; std::cin >> n;
  std::vector< lint > a(n);
  std::cin >> a;
  auto pmax = 60;
  auto make_b = [&] (auto&& a) {
    std::vector< int > is_even(pmax);
    rep(p, 0, pmax) {
      auto cnt = 0;
      for (auto x : a)
        { cnt += (x >> p) & 1; }
      is_even.at(p) = (cnt % 2 == 0);
    }
    std::vector< lint > b(n);
    rep(i, 0, n) {
      auto x = a.at(i);
      auto y = 0LL;
      for (auto p = 0; p < pmax; p++) {
        if (is_even.at(p)) {
          y += x & (1LL << p);
        }
      }
      b.at(i) = y;
    }
    return b;
  };
  auto b = make_b(a);
  // debug(a);
  // debug(b);
  std::vector< int > frozen(n, false);
  auto find = [&] (auto p) {
    auto pivot = -1;
    rep(i, 0, n) {
      if (!frozen.at(i) && (b.at(i) & (1LL << p))) {
        pivot = i;
        break;
      }
    }
    if (pivot == -1)
      { return false; }
    frozen.at(pivot) = true;
    rep(i, 0, n) {
      if (i != pivot && (b.at(i) & (1LL << p))) {
        b.at(i) ^= b.at(pivot);
      }
    }
    // debug(b);
    return true;
  };
  for (auto p = pmax - 1; p >= 0; p--) {
    find(p);
  }
  auto x = std::accumulate(all(b), 0LL, [](auto acc, auto x){ return acc ^ x; });
  auto y = std::accumulate(all(a), 0LL, [](auto acc, auto x){ return acc ^ x; });
  // debug(x, y);
  auto ret = x * 2 + y;
  std::cout << ret << std::endl;
  return 0;
}


Measured memory_bytes: 2304