#include <bits/stdc++.h>
using namespace std;
int n, a[1000001], p, ans;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    a[i] = a[i - 1] ^ i;
    cin >> p;
    ans ^= p ^ a[n % i] ^ (((n / i) % 2) * a[i - 1]);
  }
  cout << ans << endl;
  return 0;
}
