#include <bits/stdc++.h>
using namespace std;
int a[1000007];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int n, ans = 0;
  cin >> n;
  for (long long i = 1; i <= (long long)n; ++i) {
    int x;
    cin >> x;
    ans ^= x;
    a[i] = a[i - 1] ^ i;
  }
  for (long long i = 1; i <= (long long)n; ++i)
    ans ^= a[n % i] ^ (((n / i) & 1) * a[i - 1]);
  cout << ans << endl;
}
