#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  long long p[n + 1], q[n + 1], f[n + 1];
  f[0] = 0;
  for (long long i = 1; i <= n; i++) {
    f[i] = f[i - 1] ^ i;
  }
  long long Q = 0;
  for (long long i = 1; i <= n; i++) {
    cin >> p[i];
    if ((n / i) % 2) {
      q[i] = p[i] ^ f[i - 1] ^ f[n % i];
    } else {
      q[i] = p[i] ^ f[n % i];
    }
    Q ^= q[i];
  }
  cout << Q;
}
