#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool vmin(T& a, T b) {
  return (a > b) ? (a = b, true) : (false);
}
template <typename T>
bool vmax(T& a, T b) {
  return (a < b) ? (a = b, true) : (false);
}
template <typename T>
T smax(T x) {
  return x;
}
template <typename T, typename... K>
T smax(T a, const K&... args) {
  return max(a, smax(args...));
}
template <typename T>
T smin(T x) {
  return x;
}
template <typename T, typename... K>
T smin(T a, const K&... args) {
  return min(a, smin(args...));
}
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& z) {
  os << "(" << z.first << ", " << z.second << ')';
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& a) {
  bool isfirst = true;
  os << "{";
  for (auto z : a) {
    if (!isfirst) {
      os << ", ";
    }
    os << z;
    isfirst = false;
  }
  os << '}';
  return os;
}
const int inf = (signed)(~0u >> 2);
const long long llf = (signed long long)(~0ull >> 2);
template <typename T>
int vsize(vector<T>& x) {
  return (signed)x.size();
}
template <typename T>
int discrete(T* a, int* b, int n) {
  vector<T> v(a + 1, a + n + 1);
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  for (int i = 1; i <= n; i++)
    b[i] = lower_bound(v.begin(), v.end(), a[i]) - v.begin() + 1;
  return v.size();
}
mt19937 rng(time(NULL));
int randint(int l, int r) { return rng() % (r - l + 1) + l; }
const int bzmax = 28;
int n;
vector<int> a, b[2];
pair<int, int> calc(const vector<int>& x, const vector<int>& y, int msk) {
  int n = x.size(), m = y.size();
  int py = m - 1;
  pair<int, int> rt(0, 0);
  for (auto e : x) {
    while (~py && ((e & msk) + (y[py] & msk)) > msk) py--;
    rt.first += py + 1;
    rt.second += m - py - 1;
  }
  return rt;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cin >> n;
  a.resize(n);
  for (auto& x : a) {
    cin >> x;
  }
  int ans = 0;
  for (int i = 0; i < bzmax; i++) {
    b[0].clear();
    b[1].clear();
    for (auto x : a) {
      b[(x >> i) & 1].push_back(x);
    }
    int msk = (1 << i) - 1;
    int cnt = 0;
    cnt += calc(b[0], b[1], msk).first;
    cnt += calc(b[1], b[0], msk).first;
    cnt += calc(b[0], b[0], msk).second;
    cnt += calc(b[1], b[1], msk).second;
    for (auto x : a) {
      if (((x + x) >> i) & 1) {
        cnt--;
      }
    }
    assert(!(cnt & 1));
    cnt = (cnt >> 1) & 1;
    if (cnt) ans |= (1 << i);
    a.clear();
    for (auto x : b[0]) a.push_back(x);
    for (auto x : b[1]) a.push_back(x);
  }
  cout << ans << '\n';
  return 0;
}
