#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<long long> P(n);
  for (int i = 0; i < n; ++i) {
    cin >> P[i];
  }
  long long aux = 0;
  for (int i = 0;; ++i) {
    long long ind = (1LL << i), cur = 0;
    if (ind > n) break;
    vector<long long> V(n + 2, 0);
    for (long long j = 2; j <= n; ++j) {
      V[j - 1] = (((j - 1) & ind) != 0) + V[j - 2];
      if (j <= i + 1) continue;
      cur += (n / j * V[j - 1] + V[n % j]);
    }
    if (cur % 2) aux |= ind;
  }
  for (int i = 0; i < n; ++i) {
    aux = aux ^ P[i];
  }
  cout << aux << "\n";
  return 0;
}
