#include <bits/stdc++.h>
using namespace std;
int a[400010];
vector<int> c[30];
int p[30];
void add(int x, int v, int id) {
  for (int i = x + 1; i <= p[id + 1]; i += i & (-i)) c[id][i] += v;
}
int sum(int x, int id) {
  if (x < 0) return 0;
  int res = 0;
  for (int i = min(p[id + 1], x + 1); i; i -= i & (-i)) res += c[id][i];
  return res;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i <= 30; i++) p[i] = 1 << i;
  for (int i = 0; p[i] <= (int)2e7; i++) c[i].resize(p[i + 1] + 10, 0);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    int k = 0;
    for (int j = 0; p[j] <= (int)2e7; j++) {
      int cnt = 0;
      if ((a[i] >> j) & 1) k += p[j];
      cnt += sum(p[j + 1] - 1 - k, j) - sum(p[j] - 1 - k, j);
      cnt += sum(p[j + 2] - 1 - k, j) - sum(p[j + 1] + p[j] - 1 - k, j);
      if (cnt & 1) ans ^= p[j];
      add(a[i] & (p[j + 1] - 1), 1, j);
    }
  }
  printf("%d\n", ans);
  return 0;
}
