#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  int res = 0;
  for (int i = 0; i < n; ++i) {
    int p;
    cin >> p;
    res ^= p;
  }
  vector<int> f(n + 1);
  f[0] = 0;
  for (int i = 1; i <= n; ++i) f[i] = f[i - 1] ^ i;
  for (int i = 1; i <= n; ++i) {
    int q = n / i;
    int r = n % i;
    if (q % 2) res ^= f[i - 1];
    res ^= f[r];
  }
  cout << res << endl;
  return 0;
}
