#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  vector<long long> arr(n), prefix_xor;
  for (auto &i : arr) cin >> i;
  prefix_xor.push_back(0);
  for (long long i = 1; i < n; i++) {
    prefix_xor.push_back(prefix_xor[i - 1] ^ i);
  }
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    ans ^= arr[i];
    long long x = n % (i + 1);
    if ((n / (i + 1)) % 2 == 0) {
      ans ^= prefix_xor[x];
    } else {
      ans ^= prefix_xor[i] ^ prefix_xor[x];
    }
  }
  cout << ans;
}
