#include <bits/stdc++.h>
using namespace std;
int n, sum[1000111];
int main() {
  ios ::sync_with_stdio(false);
  cin.tie(NULL);
  cout << (fixed) << setprecision(6);
  while (cin >> n) {
    int res = 0;
    for (int i = (1), _b = (n); i <= _b; i++) {
      int a;
      cin >> a;
      res ^= a;
    }
    for (int i = (1), _b = (n); i <= _b; i++) sum[i] = sum[i - 1] ^ i;
    for (int i = (1), _b = (n); i <= _b; i++) {
      int k = n / i;
      if (k % 2 == 1) res ^= sum[i - 1];
      res ^= sum[n % i];
    }
    cout << res << endl;
  }
  return 0;
}
