#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
int x, y, ans, pref[N], p[N], q[N], n, i, j, a[N];
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (i = 1; i <= n; i++) cin >> p[i];
  for (i = 1; i <= n; i++) pref[i] = pref[i - 1] ^ i;
  for (i = 1; i <= n; i++) {
    q[i] = p[i];
    x = n / i;
    if (x % 2) q[i] = q[i] ^ pref[i - 1];
    y = n % i;
    q[i] = q[i] ^ pref[y];
  }
  for (i = 1; i <= n; i++) ans = ans ^ q[i];
  cout << ans;
}
