#include <bits/stdc++.h>
using namespace std;
int dp[1000005];
void init() {
  dp[0] = 0;
  for (int i = 1; i <= 1000000; i++) {
    dp[i] = i ^ dp[i - 1];
  }
  return;
}
int main() {
  int n;
  cin >> n;
  long long int x;
  long long int answer = 0;
  for (int i = 0; i < n; i++) {
    cin >> x;
    answer ^= x;
  }
  init();
  for (int i = 1; i <= n; i++) {
    answer ^= (((n / i) & 1) * dp[i - 1]) ^ (dp[n % i]);
  }
  cout << answer << "\n";
  return 0;
}
