#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = int(1e9);
const int MAX = 1000007;
long long x[MAX], res, n;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    res ^= x;
  }
  for (long long i = 1; i <= n; i++) {
    x[i] = x[i - 1] ^ i;
  }
  for (int k = 1; k <= n; k++) {
    long long q = n / k, r = n % k;
    if (q & 1) {
      res ^= x[k - 1];
    }
    res ^= x[r];
  }
  cout << res << "\n";
}
