#include <bits/stdc++.h>
using namespace std;
bool cmp(pair<int, int> a, pair<int, int> b) { return true; }
void showvi(vector<int> v) {
  for (int i = 0; i < v.size(); i++) cout << v[i] << " ";
  cout << endl;
}
void showvl(vector<long long> v) {
  for (int i = 0; i < v.size(); i++) cout << v[i] << " ";
  cout << endl;
}
void showvp(vector<pair<int, int> > v) {
  for (int i = 0; i < v.size(); i++)
    cout << v[i].first << " " << v[i].second << endl;
}
long long fastpower(long long a, long long n) {
  long long ans = 1;
  while (n > 0) {
    if (n & 1) ans = (ans * a);
    a = (a * a);
    n = n >> 1;
  }
  return ans;
}
vector<bool> prime(3000000, true);
void find(int n) {
  for (int p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (int i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
}
void solve() {
  int n;
  cin >> n;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    ans = ans ^ x;
  }
  long long a[n + 1];
  a[0] = 0;
  a[1] = 1;
  for (int i = 2; i <= n; i++) a[i] = i ^ a[i - 1];
  for (int i = 2; i <= n; i++) {
    int x = n / i;
    if (n % i == 0) {
      if (x % 2 != 0) {
        ans = ans ^ a[i - 1];
      }
    } else {
      if (x % 2 != 0) {
        x = n - x * i;
        ans = ans ^ a[x] ^ a[i - 1];
      } else {
        x = n - x * i;
        ans = ans ^ a[x];
      }
    }
  }
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
