#include <bits/stdc++.h>
using namespace std;
long long powmod(long long base, long long exponent, long long mod) {
  long long ans = 1;
  while (exponent) {
    if (exponent & 1) ans = (ans * base) % mod;
    base = (base * base) % mod;
    exponent /= 2;
  }
  return ans;
}
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
const int upperlimit = 1e6 + 100;
const int mod = 1e9 + 7;
int prefxors[upperlimit];
int main() {
  int t = 1, n, inp;
  for (int i = 1; i < upperlimit; i++) {
    prefxors[i] = prefxors[i - 1] ^ i;
  }
  while (t--) {
    scanf("%d", &n);
    int ans = 0;
    for (int i = 1; i <= n; i++) {
      int x1 = n / i;
      int x2 = n % i;
      if (x1 & 1)
        ans ^= prefxors[i - 1] ^ prefxors[x2];
      else
        ans ^= prefxors[x2];
    }
    for (int i = 1; i <= n; i++) {
      scanf("%d", &inp);
      ans ^= inp;
    }
    printf("%d", ans);
  }
  return 0;
}
