#include <bits/stdc++.h>
using namespace std;
const int oo = (int)1e9;
const double eps = 1e-7;
int arr[1000009];
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int n, a;
  cin >> n;
  for (int i = 1; i < n + 1; i++) arr[i] = arr[i - 1] ^ i;
  int xr = 0;
  for (int i = 1; i < n + 1; i++) {
    int cnt = n / i;
    if (cnt & 1) xr ^= arr[i - 1];
    int rem = n % i;
    xr ^= arr[rem];
  }
  for (int i = 0; i < n; i++) cin >> a, xr ^= a;
  cout << xr << endl;
}
