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 sys
import math as mt
import bisect
input=sys.stdin.buffer.readline  
#t=int(input())
MAXN = 1000001
  
# stores smallest prime factor for 
# every number 
#spf = [0 for i in range(MAXN)] 
def D(n) : 
    ans=0 
      
    # List to store half of the divisors 
    for i in range(1, int(mt.sqrt(n) + 1)) : 
          
        if (n % i == 0) : 
              
            # Check if divisors are equal 
            if (n / i == i) : 
                ans^=i
            else : 
                # Otherwise print both 
                #if i!=n :
                ans^=i
                #if n//i !=i:
                ans^=(n//i)
                #list.append(int(n / i)) 
                  
    # The list will be printed in reverse     
    return ans 
t=1
for __ in range(t):
    #s=input()
    n=int(input())
    #a,b,c,d=map(int,input().split())
    xori=[0]*(n+1)
    l=list(map(int,input().split()))
    xori1=[0]*(n+1)
    
    for i in range(1,n+1):
        xori[i]=xori[i-1]^i
    for i in range(2,n+1):
        xori1[i]=xori[i]^D(i)
    ans=l[0]
    for i in range(1,n+1):
        ans^=xori1[i]
    #print(xori1,xori)
    for i in range(1,n):
        ans^=(l[i])
        if (n-i+1)%2!=0:
            ans^=i
    print(ans)    
        
            