#include <bits/stdc++.h>
#pragma GCC Optimize("O3")
using namespace std;
const int N = 1e6 + 2, OO = 0x3f3f3f3f;
int n, x = 0, num, arr[N];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &num);
    x ^= num;
  }
  for (int i = 1; i <= n; i++) arr[i] = arr[i - 1] ^ i;
  for (int i = 1; i <= n; i++) {
    if ((n / i) & 1) x ^= arr[i - 1];
    x ^= arr[n % i];
  }
  printf("%d", x);
}
