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