You are given a list A of N integers. Here, N is an even number. These integers must be distributed into N/2 pairs and the power of each of the pairs is added.
The power of a pair P(i,j) consisting of the ith and jth number is defined as the XOR of the two numbers A[i] and A[j].
Write a program to determine the minimum and the maximum possible sum of the N/2 pairs.
Input format
Output format
The output consists of two space-separated integers. The first is the minimum possible sum and the second is the maximum possible sum.
Constraints
1≤N≤20;N is even
A[i] fits in 32−bit integer value.
In a sample case, the following combinations are possible:
(1,2)(3,4) -> 3+7=10
(1,3)(2,4) -> 2+6=8
(1,4)(2,3) -> 5+1=6