#include <bits/stdc++.h>
using namespace std;
int xsum[1000020], a[1000020];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, ans = 0;
  cin >> n;
  for (int i = int(1); i < int(n + 1); ++i) {
    cin >> a[i];
    ans ^= a[i];
  }
  xsum[0] = 0;
  xsum[1] = 1;
  for (int i = 2; i <= n; ++i) {
    int x = xsum[i - 1] ^ i;
    xsum[i] = xsum[i - 1] ^ i;
    int cic = n / i;
    int res = n % i;
    int cur = 0;
    if (cic & 1) cur = xsum[i - 1];
    cur ^= xsum[res];
    ans ^= cur;
  }
  cout << ans << endl;
  return 0;
}
