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 \(i^{th}\) and \(j^{th}\) 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
- First line: An integer \(N\)
- Next \(N\) lines: An integer where each denotes an element of the list
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 \le N \le 20; N \ is \ even\)
\( A[i] \) fits in \(32-bit\) integer value.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial