#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7, Base = 998244353;
const long long N = 1e6 + 7;
const long long INF = 1LL * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7LL;
const double pie = acos(-1.0);
const double EPS = 1e-9;
long long a[N], p, Q = 0, n;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 1; i <= n; ++i) {
    if (n >= i) {
      a[i - 1] += (n / i);
      a[n % i]++;
    }
  }
  for (long long i = n; i >= 0; --i) a[i] += a[i + 1];
  for (long long i = 1; i <= n; ++i) {
    cin >> p;
    Q ^= p;
    if (a[i] & 1) Q ^= i;
  }
  cout << Q << '\n';
  return 0;
}
