#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:268435456")
using namespace std;
void prepare(string s = "") {
  if (s != "") {
    freopen((s + ".in").c_str(), "r", stdin);
  }
}
const int NMAX = 100001, INF = 1000000000;
int n;
vector<long long> v;
void getData() {
  cin >> n;
  v.resize(n + 1);
  for (int i = 1; i <= n; ++i) {
    cin >> v[i];
  }
}
void solve() {
  vector<long long> d(n + 1);
  d[0] = 0;
  for (int i = 1; i <= n; ++i) {
    d[i] = d[i - 1] ^ i;
  }
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    if ((n / i) & 1) {
      ans ^= d[i - 1] ^ d[n % i];
    } else {
      ans ^= d[n % i];
    }
  }
  for (int i = 1; i <= n; ++i) {
    ans ^= v[i];
  }
  cout << ans << endl;
}
int main() {
  prepare();
  getData();
  solve();
  return 0;
}
