#d1204. XOR Inverse
XOR Inverse
XOR Inverse
Problem Description
You are given an array of non-negative integers. You must choose a non-negative integer and XOR every with to form a new array . You want the number of inversions in to be minimized. If multiple achieve the minimum, output the smallest .
An inversion is a pair in array satisfying and .
Input Format
The first line contains a positive integer .
The next line contains non-negative integers .
Output Format
Output two numbers: the minimum number of inversions in , and the smallest achieving it.
Sample Input 1
4
0 1 3 2
Sample Output 1
1 0
Sample Input 2
9
10 7 9 10 7 5 5 3 5
Sample Output 2
4 14
Sample Input 3
3
8 10 3
Sample Output 3
0 8
Constraints
, .