#include <bits/stdc++.h>
using namespace std;
long long vxor[1000000];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, Q = 0, a, b;
  vxor[0] = 0;
  for (long long i = 1; i < 1000000; i++) vxor[i] = vxor[i - 1] ^ i;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a;
    Q ^= a;
  }
  for (long long i = 1; i < n + 1; i++) {
    a = (n / i) % 2;
    b = n % i;
    if (a) Q ^= vxor[i - 1];
    Q ^= vxor[b];
  }
  return cout << Q, 0;
}
