#include <bits/stdc++.h>
using namespace std;
template <class T>
inline int maximize(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline int minimize(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const int N = 1000005, INF = 0x3f3f3f3f;
int ans, d[N];
int main() {
  for (int i = 1; i < N; ++i) d[i] = d[i - 1] ^ i;
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    int t;
    scanf("%d", &t);
    ans ^= t;
  }
  for (int i = 1; i <= n; ++i) {
    int q = n / i, r = n % i;
    if (q & 1) ans ^= d[i - 1];
    ans ^= d[r];
  }
  cout << ans << endl;
  return 0;
}
