#include <bits/stdc++.h>
using namespace std;
int main() {
  long n;
  cin >> n;
  vector<long long> a;
  for (long i = 0; i < n; i++) {
    long long b;
    cin >> b;
    a.push_back(b);
  }
  long digits[30];
  for (int d = 0; d < 30; d++) {
    digits[d] = 0;
    for (long i = 0; i < n; i++) {
      digits[d] += (a[i] >> d) % 2;
    }
    digits[d] = (digits[d] % 2) * ((n - 1) % 2);
  }
  for (int d = 1; d < 30; d++) {
    vector<long long> p;
    for (long long x : a) {
      long long b = x - ((x >> d) << d);
      p.push_back(b);
    }
    sort(p.begin(), p.end());
    long ind1 = 0, ind2 = n - 1;
    long long counter = 0, curcounter = 0;
    long long pow = (1 << d);
    while (ind1 < ind2) {
      if (p[ind1] + p[ind2] < pow) {
        counter += curcounter;
        ind1 += 1;
      } else {
        curcounter += 1;
        ind2 -= 1;
      }
    }
    for (long i = ind1; i < n; i++) {
      counter += (n - 1 - i);
    }
    digits[d] += (counter % 2);
    digits[d] = (digits[d] % 2);
  }
  long long res = 0;
  for (int d = 0; d < 30; d++) {
    res += digits[d] * (1 << d);
  }
  cout << res;
  return 0;
}
