#include <bits/stdc++.h>
using ll = long long int;
using namespace std;
int32_t main() {
  int n;
  cin >> n;
  std::vector<int> arr(n, 0);
  for (int i = 0; i < n; i += 1) cin >> arr[i];
  std::vector<int> no(1e6 + 1, 0);
  for (int i = 1; i <= 1e6; i++) {
    no[i] = i;
  }
  for (int i = 1; i <= 1e6; i++) {
    no[i] ^= no[i - 1];
  }
  for (int i = 1; i < n; i++) {
    arr[i] ^= arr[i - 1];
  }
  int x = 0;
  for (int i = 2; i <= n; i++) {
    int d1 = n % i;
    int d2 = n / i;
    if ((d2 & 1) == 1) {
      x ^= no[i - 1];
    }
    x ^= no[d1];
  }
  cout << (x ^ arr[n - 1]) << endl;
  return 0;
}
