#include <bits/stdc++.h>
using namespace std;
int tot = 1, cnt, n, ans;
int f[1000006];
int main() {
  while (scanf("%d", &n) != EOF) {
    for (; tot <= n; ++tot) f[tot] = f[tot - 1] ^ tot;
    ans = 0;
    for (int x, i = 1; i <= n; ++i) {
      scanf("%d", &x);
      ans ^= x;
    }
    for (int i = 1; i <= n; ++i) {
      cnt = n / i;
      if (cnt & 1) ans ^= f[i - 1];
      ans ^= f[n % i];
    }
    printf("%d\n", ans);
  }
  return 0;
}
