#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int n, p, ans[N], sum;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &p);
    sum ^= p;
  }
  for (int i = 1; i <= n; i++) {
    ans[i] = ans[i - 1] ^ i;
  }
  for (int i = 1; i <= n; i++) {
    int x = n / i, y = n % i;
    if (x % 2 != 0) sum ^= ans[i - 1];
    sum ^= ans[y];
  }
  cout << sum;
  return 0;
}
