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>).
import random, math
from copy import deepcopy as dc
from bisect import bisect_left, bisect_right


def findXOR(n):
	rem = n % 4
	if rem == 0:
		return n
	elif rem == 1:
		return 1
	elif rem == 2:
		return n + 1
	else:
		return 0


# Function to call the actual solution
def solution(li):
	ans = 0
	terms = len(li)
	for i in range(len(li)):
		ans ^= li[i]
		modded = i + 1
		place = terms//modded
		if place % 2 == 0:
			ans ^= findXOR((terms%modded) - 1)
		else:
			ans ^= findXOR(terms-1) ^ findXOR((terms%modded) - 1)

	return ans


# Function to take input
def input_test():
	# for _ in range(int(input())):
		n = int(input())
		# a, b = map(int, input().strip().split(" "))
		# a, b, c = map(int, input().strip().split(" "))
		li = list(map(int, input().strip().split(" ")))
		out = solution(li)
		print(out)

# Function to check test my code
def test():
	pass


input_test()
# test()