#include <bits/stdc++.h>
using namespace std;
int xr[1000001];
int main() {
  xr[0] = 0;
  int n;
  cin >> n;
  int temp;
  int result = 0;
  for (int i = 1; i <= n; i++) xr[i] = xr[i - 1] ^ i;
  for (int i = 1; i <= n; i++) {
    int dv = n / i;
    if (dv % 2 == 0) {
      result ^= xr[n % i];
    } else
      result ^= xr[i - 1] ^ xr[n % i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> temp;
    result ^= temp;
  }
  cout << result << endl;
}
