#include <bits/stdc++.h>
const int MAXN = 1e6 + 10;
int n, ans, Xor[MAXN];
inline int read() {
  int X = 0, flag = 0;
  char ch = 0;
  while (!isdigit(ch)) flag |= ch == '-', ch = getchar();
  while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
  return flag ? -X : X;
}
signed main() {
  n = read();
  for (int i = 1; i <= n; i++) {
    ans ^= read(), Xor[i] = Xor[i - 1] ^ i;
  }
  for (int i = 1; i <= n; i++) {
    if ((n / i) & 1) ans ^= Xor[i - 1];
    ans ^= Xor[n % i];
  }
  printf("%d\n", ans);
  return 0;
}
