F. Fake Solution
time limit per test
2 seconds
memory limit per test
512 megabytes
input
standard input
output
standard output

This is a problem from a story about misreading the problem statement and coming up with a (fake) solution.

Consider a sequence of $$$N$$$ non-negative integers $$$a_1, \dots, a_N$$$. A single operation consists of the following 3 steps:

  1. Choose any index $$$1 \leq i \leq N$$$.
  2. Choose any non-negative integer $$$j$$$ such that $$$2^j \leq a_i$$$.
  3. Change $$$a_i$$$ to $$$a_i \mathbin{|} (a_i - 2^j)$$$. Here, $$$-$$$ denotes natural subtraction, and $$$\mathbin{|}$$$ denotes bitwise-or.

Your goal is to make the bitwise-or of the whole sequence as big as possible by performing zero or more operations. You also need to solve the minimum number of operations to obtain the maximum bitwise-or.

Input

There are multiple testcases.

The first line is an integer $$$T$$$ denote the number of testcases. Each testcase starts with a positive integer $$$N$$$, and then $$$N$$$ space-seperated non-negative integers on the next line is $$$a_i$$$.

  • $$$1 \leq T \leq 10^6$$$
  • $$$1 \leq N \leq 10^6$$$
  • The sum of $$$N$$$ in each testcases is not greater than $$$10^6$$$.
  • $$$0 \leq a_i \lt 2^{30}, \forall 1 \leq i \leq N$$$
Output

For each testcases, output a single line consists of two space-seperated integers, denoting the maximum bitwise-or and the minimum operation needed to obtain that maximum.

Examples
Input
1
3
1 5 9
Output
15 1
Input
1
1
21
Output
31 2