#include <bits/stdc++.h>
int acum[1000100];
int main() {
  int n;
  scanf("%d", &n);
  int num;
  int resp = 0;
  acum[0] = 0;
  for (int i = 1; i <= n; i++) {
    acum[i] = acum[i - 1] ^ i;
  }
  for (int i = 2; i <= n; i++) {
    int nv = n / i;
    if (nv % 2 != 0) {
      resp ^= acum[i - 1];
    }
    int rest = n % i;
    resp ^= acum[rest];
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &num);
    resp ^= num;
  }
  printf("%d\n", resp);
  return 0;
}
