Catherine received an array of integers as a gift for March 8. Eventually she grew bored with it, and she started calculated various useless characteristics for it. She succeeded to do it for each one she came up with. But when she came up with another one — xor of all pairwise sums of elements in the array, she realized that she couldn't compute it for a very large array, thus she asked for your help. Can you do it? Formally, you need to compute

$$$ (a_1 + a_2) ⊕ (a_1 + a_3) ⊕ … ⊕ (a_1 + a_n) \\\ ⊕ (a_2 + a_3) ⊕ … ⊕ (a_2 + a_n) \\\ … \\\ ⊕ (a_{n-1} + a_n) \\\ $$$

Here x ⊕ y is a bitwise XOR operation (i.e. x ^ y in many modern programming languages). You can read about it in Wikipedia: <https://en.wikipedia.org/wiki/Exclusive_or#Bitwise_operation>.

Input

The first line contains a single integer n (2 ≤ n ≤ 400 000) — the number of integers in the array.

The second line contains integers a_1, a_2, …, a_n (1 ≤ a_i ≤ 10^7).

Output

Print a single integer — xor of all pairwise sums of integers in the given array.

Examples

Input


2
1 2


Output


3

Input


3
1 2 3


Output


2

Note

In the first sample case there is only one sum 1 + 2 = 3.

In the second sample case there are three sums: 1 + 2 = 3, 1 + 3 = 4, 2 + 3 = 5. In binary they are represented as 011_2 ⊕ 100_2 ⊕ 101_2 = 010_2, thus the answer is 2.

⊕ is the bitwise xor operation. To define x ⊕ y, consider binary representations of integers x and y. We put the i-th bit of the result to be 1 when exactly one of the i-th bits of x and y is 1. Otherwise, the i-th bit of the result is put to be 0. For example, 0101_2   ⊕   0011_2 = 0110_2.
import java.util.*;
import java.io.*;
public class EdD {
	static long num = 998244353;
	public static void main(String[] args) throws Exception{
		

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		int n = Integer.parseInt(bf.readLine());
 		StringTokenizer st = new StringTokenizer(bf.readLine());
 		int[] array = new int[n];
 		for(int j =0;j<n;j++)
 			array[j] = Integer.parseInt(st.nextToken());
 		long prod = 1;
 		long ans = 0;
 		while(prod<=10000000L){
 			prod*=2L;
 			BIT bit = new BIT((int)prod);// bit.query(i) is number that are (i-1)%prod
 			long numPairs = 0;
 			for(int j = n-1;j>=0;j--){
 				long start = ((prod/2-array[j]%prod)%prod+prod)%prod;
 				long end = prod-1-array[j]%prod;
 				if (start > end){
	 				numPairs+=bit.query((int)start+1, (int)prod);
	 				numPairs+=bit.sum((int)end);
 				}
 				else{
 					numPairs+=bit.query((int)start+1,  (int)end+1);
 				}
 				bit.add((int)(array[j]%prod+1),  1L);
 			}
 			if (numPairs%2 == 1)
 				ans+=(prod/2);
 		}
 		
 		
 		out.println(ans);
	 		
 		out.close();
 		
 		
 		
 	}
	static class BIT {
        long[] tree;
        public BIT(int size) {
            tree = new long[size + 1];
        }
        public long sum(int i) {
            long ans = 0;
            while (i > 0) {
                ans += tree[i];
                i -= i & -i;
            }
            return ans;
        }
 
        public long query(int i, int j) {
            return sum(j) - sum(i - 1);
        }
 
        public void add(int i, long val) {
            while (i < tree.length) {
                tree[i] += val;
                i += i & -i;
            }
        }
 
        public void set(int i, long val) {
            add(i, val - query(i, i));
        }
    }
}
 	
 
//StringJoiner sj = new StringJoiner(" "); 
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is

 		
 		
 		
 		
	


