#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1000000007;
long long int PosX[] = {0, 1, 0, -1, 1, 1, -1, -1};
long long int PosY[] = {1, 0, -1, 0, 1, -1, 1, -1};
void Solve(long long int test) {
  long long int n, x, ans = 0;
  cin >> n;
  vector<long long int> xorr(n + 1, 0);
  for (long long int i = 1; i <= n; ++i) xorr[i] = xorr[i - 1] ^ i;
  for (long long int i = 0; i < n; ++i) {
    cin >> x;
    ans = ans ^ x;
  }
  for (long long int i = 2; i <= n; ++i) {
    long long int repeat = n / i;
    long long int left = n % i;
    if (repeat & 1) ans = ans ^ xorr[i - 1];
    ans = ans ^ xorr[left];
  }
  cout << ans << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << fixed << setprecision(20);
  long long int t = 1;
  for (long long int test = 1; test <= t; ++test) {
    Solve(test);
  }
  return 0;
}
