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 p1, p2, ..., pn. Lets write down some magic formulas:

<image><image>

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

The expression <image> 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.

Input

The first line of the input contains the only integer n (1 ≤ n ≤ 106). The next line contains n integers: p1, p2, ..., pn (0 ≤ pi ≤ 2·109).

Output

The only line of output should contain a single integer — the value of Q.

Examples

Input

3
1 2 3


Output

3
	import java.util.*;
	public class Codeforces {
		static ArrayList<Integer> index[];
		static int include =0;
		public static void main(String args[]) {
			Scanner input = new Scanner(System.in);
			//int test = input.nextInt();
			//while(test-->0) {
				int n = input.nextInt();
				int arr[] = new int[n];
				long res =0;
				for(int i =0;i<n;i++) {
					arr[i] = input.nextInt();
					res^= arr[i];
				}
				long prefix[] = new long[n];
				for(int i=1;i<n;i++)prefix[i] = prefix[i-1]^i;
				for(int i =2;i<=n;i++) {
					if((n/i)%2 == 0) {
						res^=prefix[n%i];
					}else {
						res^= (prefix[i-1]^prefix[n%i]);
					}
				}
				System.out.println(res);
				
				
				
				
			//}
				
				
		}
		public static int ok(int col,char c[][],int row,int m) {
			include =0;
			HashSet<Integer>set = new HashSet<>();
			int cc = 0;
			while(true) {
				boolean ok = true;
				for( int i =0;i<row-1;i++) {
					if(c[i][col] == c[i+1][col]) {
						
						for(int j =col;j<m;j++) {
							if(set.contains(j))continue;
							if(c[i][j]>c[i+1][j] && !set.contains(j)) {
								include++;
								set.add(j);
								ok = false;
								break;
							}else if(c[i][j] == c[i+1][j])continue;
							else break;
						}
					}
				}
				cc++;
				if(ok)break;
			}
			return include;
		}
		public static boolean valid(int col,char c[][],int row,int m) {
			for(int i =0;i<row-1;i++)if(c[i][col]>c[i+1][col])return false;
			return true;
		}
		
		public static boolean special(String a,String b) {
			return equals(a,b) && a.length()>b.length();
			
		}
		public static boolean equals(String a,String b) {
			HashSet<Character>set = new HashSet<>();
			for(char c:a.toCharArray())set.add(c);
			for(char c:b.toCharArray())set.add(c);
			return set.size() == 1;
		}
		public static String reverse(String s) {
			StringBuilder sb = new StringBuilder(s);
			return sb.reverse().toString();
			
		}
		public static int check(char c[],char ch[]) {
			ArrayList<Integer>list = new ArrayList<>();
			//System.out.println(Arrays.toString(c));
			for(char it:c) {
				if(it != '$')list.add(it-'0');
			}
			int index1 = -1;
			for(int i =0;i<list.size();i++) {
				if(list.get(i) != 0) {
					index1 = i;
					break;
				}
			}
			ArrayList<Integer>list1 = new ArrayList<>();
			for(char it:ch) {
				if(it != '$')list1.add(it-'0');
			}
			int index2 = -1;
			for(int i =0;i<list1.size();i++) {
				if(list1.get(i) != 0) {
					index2 = i;
					break;
				}
			}
			if(list.size()-index1+1>list1.size()-index2+1) return 1;
			return 2;
		}
		public static void print(char c[]) {
			ArrayList<Integer>list = new ArrayList<>();
			for(char it:c) {
				if(it != '$')list.add(it-'0');
			}
			int index = -1;
			for(int i =0;i<list.size();i++) {
				if(list.get(i) != 0) {
					index = i;
					break;
				}
			}
			
			 if(list.size() == 0)System.out.println(-1);
			 else if(index == -1)System.out.println(0);
			else {
				for(int i =index;i<list.size();i++)System.out.print(list.get(i));
				System.out.println();
			}
		}
	
		
		public  static void sort(int arr[]) {
			ArrayList<Integer>list = new ArrayList<Integer>();
			for(int it:arr)list.add(it);
			Collections.sort(list);
			for(int i=0;i<arr.length;i++)arr[i] = list.get(i);
			
		}
	}
	
	
	class Pair{
		int a, b;
		public Pair(int a,int b) {
			this.a = a;
			this.b = b;
		}
	}
