#include <bits/stdc++.h>
using namespace std;
int flag[1000010] = {0};
int main() {
  int sum = 0, i, n, temp;
  cin >> n;
  for (i = 0; i < n; i++) {
    scanf("%d", &temp);
    sum = sum ^ temp;
  }
  for (i = 1; i <= n; i++) flag[i] = flag[i - 1] ^ i;
  for (i = 1; i <= n; i++) {
    int num = n / i, remain = n % i;
    sum = sum ^ flag[remain];
    if (num & 1) sum = sum ^ flag[i - 1];
  }
  cout << sum << endl;
}
