#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 10;
const long long mod = 1e9 + 7;
template <class T1, class T2, class T3>
void printTuple(tuple<T1, T2, T3> t) {
  cout << get<0>(t) << " " << get<1>(t) << " " << get<2>(t) << '\n';
}
template <class T1, class T2>
void printPair(pair<T1, T2> p) {
  cout << p.first << " " << p.second << '\n';
}
template <class T>
void printArray(vector<T> arr) {
  for (int i = 0; i < int((arr).size()); i++) {
    cout << arr[i] << " ";
  }
  cout << '\n';
}
template <class T>
void read(vector<T> &a, int n) {
  for (int i = 0; i < n; i++) cin >> a[i];
}
template <class T>
void read(T *a, int n) {
  for (int i = 0; i < n; i++) cin >> a[i];
}
template <class T>
void readIdx(vector<pair<T, int>> &a, int n) {
  for (int i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
}
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  read(a, n);
  int ret = a[0];
  for (int i = 1; i < n; i++) ret ^= a[i];
  vector<int> pref(n + 1);
  pref[0] = 0, pref[1] = 1;
  for (int i = 2; i <= n; i++) pref[i] = pref[i - 1] ^ i;
  for (int i = 2; i <= n; i++) {
    int div = n / i, rem = n % i;
    if (div & 1) ret ^= pref[i - 1];
    if (rem) ret ^= pref[rem];
  }
  cout << ret << '\n';
}
