#include <bits/stdc++.h>
using namespace std;
const int N = 1000010;
int a[N], d[N];
int main() {
  int n, p;
  scanf("%d", &n);
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &p);
    ans ^= p;
  }
  int x, y;
  for (int i = 2; i <= n; ++i) {
    x = n / i;
    y = n % i;
    if (x & 1) {
      a[1] += 2;
      a[i] -= 1;
      a[y + 1] -= 1;
    } else {
      a[1] += 1, a[y + 1] -= 1;
    }
  }
  for (int i = 1; i < n; ++i) {
    a[i] = (a[i] + a[i - 1]) % 2;
    if (a[i]) ans ^= i;
  }
  printf("%d\n", ans);
  return 0;
}
