#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int *p = new int[n + 1], c = 0;
  int *m = new int[n + 1];
  for (int i = 0; i <= n; i++) {
    p[i] = m[i] = 0;
    c ^= i;
    m[i] = c;
  }
  int f = 0;
  for (int i = 1; i <= n; i++) {
    cin >> p[i];
    f ^= p[i];
  }
  int r = 0;
  for (int i = 2; i <= n; i++) {
    int grps = (n / i);
    int rem = n % i;
    if (grps & 1) r ^= m[i - 1];
    r ^= m[rem];
  }
  cout << (r ^ f);
  return 0;
}
