#include <bits/stdc++.h>
using namespace std;
signed main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long TESTS = 1;
  while (TESTS--) {
    long long n, e;
    cin >> n;
    long long res = 0;
    for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
         i += 1 - 2 * ((0) > (n))) {
      cin >> e;
      res ^= e;
    }
    long long f[n + 1];
    f[0] = 0;
    for (__typeof(n + 1) i = (1) - ((1) > (n + 1));
         i != (n + 1) - ((1) > (n + 1)); i += 1 - 2 * ((1) > (n + 1))) {
      f[i] = f[i - 1] ^ i;
    }
    for (__typeof(n + 1) i = (1) - ((1) > (n + 1));
         i != (n + 1) - ((1) > (n + 1)); i += 1 - 2 * ((1) > (n + 1))) {
      if ((n / i) % 2) {
        res ^= f[i - 1];
      }
      long long rem = n % i;
      res ^= f[rem];
    }
    cout << res;
  }
  return 0;
}
