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