#include <bits/stdc++.h>
using namespace std;
long long N = 1000005;
long long a[1000005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, p, s = 0, temp;
  a[0] = 0;
  for (long long i = 1; i < N; i++) {
    a[i] = a[i - 1] ^ i;
  }
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> p;
    s = s ^ p;
  }
  for (long long i = 2; i <= n; i++) {
    temp = n / i;
    if (temp % 2 != 0) {
      s = s ^ a[i - 1];
    }
    temp = n % i;
    s = s ^ a[temp];
  }
  cout << s;
  return 0;
}
