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>).
from sys import stdin ,stdout 
from math import ceil , sqrt
input=stdin.readline
def print(*args, end='\n', sep=' ') -> None:
    stdout.write(sep.join(map(str, args)) + end)

def xor1(n):
    if n%4==0 : return n
    elif n%4==1 : return 1
    elif n%4==2 : return n+1
    return 0 

def findOddXOR(n):
    return ((xor1(n)) ^ (2 * xor1(n // 2)))

def evenXorRange(l, r):
    global n
    xor_r = 2 *xor1(r // 2)

    xor_l = 2 * xor1((l - 1) // 2)

    return xor_l ^ xor_r

def dev(x):
    xor= 0 ; mid=x//2 ; sqr=int(sqrt(x))
    for i in range(1,sqr):
        xor^=x%i 
        if sqr+i<mid : xor^=x%(sqr+i)
    xor^=(x-1-mid) 
    if x&1:
        a=mid+1-sqr-sqr-1
        if a>=1:
            xor^=findOddXOR(a*2)
    else:
        a=mid+1-sqr-sqr-1
        if a>=1:
            xor^=evenXorRange(1,a*2)
    if n-x & 1:xor^=x
    return xor




n=int(input()) ; arr=list(map(int,input().split()))  ; XOR=0
for i in range(n):
    XOR^=dev(i+1)^arr[i] 
print(XOR)