#include <bits/stdc++.h>
using namespace std;
const int M = 1000000007;
const int MM = 998244353;
const long double PI = acos(-1);
const long long INF = 2e18;
template <typename T, typename T1>
void amax(T &a, T1 b) {
  if (b > a) a = b;
}
template <typename T, typename T1>
void amin(T &a, T1 b) {
  if (b < a) a = b;
}
long long power(long long b, long long e) {
  if (e == 0) return 1;
  if (e & 1) return b * power(b * b, e / 2);
  return power(b * b, e / 2);
}
long long power(long long b, long long e, long long m) {
  if (e == 0) return 1;
  if (e & 1) return b * power(b * b % m, e / 2, m) % m;
  return power(b * b % m, e / 2, m);
}
long long modinv(long long a, long long m) { return power(a, m - 2, m); }
int TLE_TERROR() {
  long long n, ans = 0;
  cin >> n;
  long long a[n], c[n + 1];
  memset(c, 0, sizeof(c));
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    ans ^= a[i];
  }
  for (long long i = 2; i <= n; i++) {
    long long z = n / i;
    c[i - 1] += z;
    z *= i;
    long long zz = n - z;
    c[zz]++;
  }
  for (long long i = n - 1; i >= 0; i--) c[i] += c[i + 1];
  for (long long i = 1; i <= n; i++) {
    if (c[i] % 2 != 0) ans ^= i;
  }
  cout << ans;
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int TESTS = 1;
  while (TESTS--) TLE_TERROR();
  return 0;
}
