#include <bits/stdc++.h>
using namespace std;
const long long NAX = 1e6 + 2;
long long n;
void solve() {
  cin >> n;
  vector<long long> v(n);
  long long ans = 0;
  for (long long& el : v) cin >> el, ans ^= el;
  vector<long long> pref(NAX, 0);
  for (long long i = 2; i <= n; ++i) {
    long long quot = n / i;
    long long rem = n % i;
    if (quot % 2 != 0) pref[1]++, pref[i]--;
    if (rem != 0) pref[1]++, pref[rem + 1]--;
  }
  for (long long i = 1; i < NAX; ++i) pref[i] += pref[i - 1];
  for (long long i = 1; i <= n; ++i) {
    if (pref[i] % 2 != 0) ans ^= i;
  }
  cout << ans << endl;
}
int main() {
  ios_base ::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  ;
  int tt;
  tt = 1;
  for (int i = 1; i <= tt; ++i) {
    solve();
  }
  return 0;
}
