#include <bits/stdc++.h>
using namespace std;
int s[1000001];
int main() {
  int n, p;
  int sol = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    s[i] = s[i - 1] ^ i;
    cin >> p;
    sol ^= p;
    int m = n / i, r = n % i;
    sol ^= s[r];
    if (m & 1) sol ^= s[i - 1];
  }
  cout << sol << endl;
  return 0;
}
