#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000 * 1000 * 1000 + 7;
const long long N = 1000000 * 10 + 1;
const double PI = 3.14159265;
long long comp(const long long n) {
  switch (n & 3) {
    case 0:
      return n;
    case 1:
      return 1;
    case 2:
      return n + 1;
    case 3:
      return 0;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  long long a[n];
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    ans ^= a[i];
  }
  for (int i = 2; i <= n; ++i) {
    int dum = n % (2 * i);
    if (dum > i) {
      dum -= i;
      ans ^= comp(dum);
      ans ^= comp(i - 1);
    } else if (dum == i) {
      ans ^= comp(i - 1);
    } else {
      ans ^= comp(dum);
    }
  }
  cout << ans;
}
