People in the Tomskaya region like magic formulas very much. You can see some of them below.

Imagine you are given a sequence of positive integer numbers *p*<sub class="lower-index">1</sub>, *p*<sub class="lower-index">2</sub>, ..., *p*<sub class="lower-index">*n*</sub>. Lets write down some magic formulas:

Here, "mod" means the operation of taking the residue after dividing.

The expression <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/b364f2e04c665b78b924ec10666327a4ef4635bc.png" style="max-width: 100.0%;max-height: 100.0%;"/> means applying the bitwise *xor* (excluding "OR") operation to integers *x* and *y*. The given operation exists in all modern programming languages. For example, in languages C++ and Java it is represented by "^", in Pascal — by "xor".

People in the Tomskaya region like magic formulas very much, but they don't like to calculate them! Therefore you are given the sequence *p*, calculate the value of *Q*.
The first line of the input contains the only integer *n* (1 ≤ *n* ≤ 10<sup class="upper-index">6</sup>). The next line contains *n* integers: *p*<sub class="lower-index">1</sub>, *p*<sub class="lower-index">2</sub>, ..., *p*<sub class="lower-index">*n*</sub> (0 ≤ *p*<sub class="lower-index">*i*</sub> ≤ 2·10<sup class="upper-index">9</sup>).
#include<bits/stdc++.h>
using namespace std;
//aag lage basti me bhai tera masti me//
//ek achcha programmer wo hai cntise pata ho ki konsa contest  dena hai aur konsa nhi//
#define gc getchar_unlocked
#define inf 1e18
#define pb push_back
#define fo(i,n) for(int i=0;i<n;i++)
#define fo1(i,n) for(int i=1;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define PI 3.1415926535897932384626
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             998244353
#define inf             1e18
#define p(x,y)         fixed<<setprecision(y)<<x
#define mk(type,arr,n)  type *arr=new type[n];// dynamic memory allocation
#define w(x)            int x; cin>>x; while(x--)
#define lc (id<<1)      //segtree left child;
#define rc (id<<1)|1    //segtree right child;
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
//=======================
typedef pair<int, int>  pii;
typedef vector<ll>     vi;
typedef vector<pii>     vpii;
typedef vector<vi>      vvi;
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int>>
//=======================
const int MOD = 1e9 + 7;
const int N = 300005, M = N;
//=======================
// vector <int> vec;
// int cnt[3];
// void up(ll x, ll y)
// {
// 	if (y == 0)
// 		return;
// 	if (x == 0)
// 	{
// 		x = y;
// 	}
// 	x = min(x, y);
// }
// int d[100005];
// vi v[100005];
// void dfs(int u,int f,int count)
// {
//  if(d[u])count++;
//  else 
//  {
//  	count=0;
//  }
//  if (count>m)
//  {
//  	return ;
//  }
//  if (v[u].size()==1 && u!=1)
//  	{
//  		ans++;
//  	}
//  for (auto g:v[u])
//  {
//  	if (g!=f) 
//  		dfs(g,u,count);
 
 
// }
// }
//6 4 5 2 1000
// 2 0 rue-de-londres 1
// 0 1 rue-d-amsterdam 1
// 3 1 rue-d-athenes 1
// 2 3 rue-de-rome 2
// 1 2 rue-de-moscou 3
// 4 rue-de-londres rue-d-amsterdam
// rue-de-moscou rue-de-rome
// 3 rue-d-athenes rue-de-moscou
// rue-de-londres



	int power(int a, int b)	//a is base, b is exponent
	{
		if(b==0)
			return 1;
		if(b==1)
			return a;
		if(b%2 == 1)
			return (power(a,b-1)*a)%mod;
		int q = power(a,b/2);
		return (q*q)%mod;
	}
 ll n , m ;

int main()
{int n,m;
	cin>>n;
	int c = 0,i;
	for (int i = 0; i < n; ++i)
	{   int x;
		cin>>x;
		c = c^x;
	}
	int g [n+2];
	g[0] = 0;
	for (int i = 1; i <= n; ++i)
	{
		g[i] = i^g[i-1];
	}
	for (int i = 1; i <= n; ++i)
	{
		if ((n/i)%2!=0)
		{
			c = c^g[i];
		}
		if (n%i)
		{
			c = c^g[n%i];
		}
	}
	cout<<c;
   }



	

