#include <bits/stdc++.h>
using namespace std;
int cu[1000010];
int main() {
  ios_base::sync_with_stdio(0);
  int n, p, ans;
  cin >> n;
  cu[0] = ans = 0;
  for (int i = 1; i <= n; i++) cu[i] = i ^ cu[i - 1];
  for (int i = 1; i <= n; i++) {
    cin >> p;
    ans ^= p;
    if ((n / i) % 2) ans ^= cu[i - 1];
    ans ^= cu[n % i];
  }
  cout << ans << "\n";
  return 0;
}
