#include <bits/stdc++.h>
using namespace std;
long long a[1000010];
long long m;
int main() {
  int n;
  a[0] = 0, a[1] = 1;
  for (int i = 2; i < 1e6 + 1; i++) a[i] = a[i - 1] ^ i;
  while (cin >> n) {
    long long sum = 0;
    for (int i = 0; i < n; i++) {
      scanf("%lld", &m);
      sum ^= m;
    }
    for (int i = 2; i <= n; i++) {
      int re = n % i;
      int t = n / i;
      if (t % 2) {
        sum ^= a[i - 1];
        if (re != 0) sum ^= a[re];
      } else if (re != 0)
        sum ^= a[re];
    }
    printf("%lld\n", sum);
  }
  return 0;
}
