#include <bits/stdc++.h>
using namespace std;
vector<int> vec;
int n;
int sum[1000005];
void init() {
  for (int i = 1; i <= n + 1; ++i) {
    sum[i] = sum[i - 1] ^ i;
  }
}
void solve() {
  for (int i = 1; i <= n; ++i) {
    int p = n / i;
    if (p % 2) vec.push_back(sum[i - 1]);
    int q = n % i;
    if (q) {
      vec.push_back(sum[q]);
    }
  }
}
int main() {
  cin >> n;
  init();
  for (int i = 0; i < n; ++i) {
    int t;
    cin >> t;
    vec.push_back(t);
  }
  int ans = 0;
  solve();
  for (int i = 0; i < vec.size(); ++i) {
    ans = ans ^ vec[i];
  }
  cout << ans << endl;
  return 0;
}
