Master Zhu and Instability

아직 제출이 없습니다시간 제한1초메모리 제한512 MB

문제

Consider an array AA of length NN. The instability of AA is defined as _i=1N1(A\[i+1]A\[i]).\sum\limits\_{i = 1}^{N - 1} (|A\[i + 1] - A\[i]|)\text{.}

Master Zhu wants to stabilize an array. In order to do that, he wants to select an integer XX and change every element A\[i]A\[i] to (A\[i]X)(A\[i] \oplus X). Here, uvu \oplus v is the bitwise XOR of uu and vv.

Find the smallest non-negative integer XX Master Zhu must choose to minimize the instability of a given array, and calculate the resulting instability.

입력

The first line of input contains an integer NN (1N1051 \le N \le 10^5). Next line contains NN integers A\[i]A\[i], indicating the elements of the array (0A\[i]<2200 \le A\[i] < 2^{20}).

출력

Print a single line containing two integers: the smallest non-negative integer XX which must be used in order to reach the minimum possible instability and the resulting instability itself.