#include <bits/stdc++.h>
using namespace std;
const int INF = 123456789;
template <class T>
void scanint(T& x) {
  register int c = getchar();
  x = 0;
  int m = 0;
  if (c == '-') {
    m = 1;
  }
  for (; (c < 48 || c > 57); c = getchar())
    ;
  for (; c > 47 && c < 58; c = getchar()) {
    x = (x << 1) + (x << 3) + c - 48;
  }
  if (m == 1) {
    x *= -1;
  }
}
template <typename T>
void cinall(T& t) {
  cin >> t;
}
template <typename T, typename... Args>
void cinall(T& t, Args&... args) {
  cin >> t;
  cinall(args...);
}
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cinall(n);
  ;
  vector<int> v(n);
  vector<int> xv(n + 1);
  long long sol = 0;
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
    sol ^= v[i];
    xv[i + 1] = xv[i] ^ i;
  }
  for (int i = 2; i <= n; ++i) {
    sol ^= xv[((n / i) % 2) * i] ^ xv[(n % i) + 1];
  }
  cout << sol;
  return 0;
}
