Consider an array, , of integers (). We take all consecutive subsequences of integers from the array that satisfy the following:

For example, if our subsequences will be:

For each subsequence, we apply the bitwise XOR () operation on all the integers and record the resultant value. Since there are subsequences, this will result in numbers.

Given array , find the XOR sum of every subsequence of and determine the frequency at which each number occurs. Then print the number and its respective frequency as two space-separated values on a single line.

Input Format

The first line contains an integer, , denoting the size of the array.
Each line of the subsequent lines contains a single integer describing element .

Constraints

Output Format

Print space-separated integers on a single line. The first integer should be the number having the highest frequency, and the second integer should be the number's frequency (i.e., the number of times it appeared). If there are multiple numbers having maximal frequency, choose the smallest one.

Sample Input 0

4
2
1
1
3

Sample Output 0

1 3

Explanation 0

Let's find the XOR sum for all consecutive subsequences. We'll refer to the frequency of some number as , and keep a running sum for each frequency:

  1. , frequencies:
  2. , frequencies: and
  3. , frequencies: and
  4. , frequencies: , , and
  5. , frequencies: , , and
  6. , frequencies: , , , and
  7. , frequencies: , , , and
  8. , frequencies: , , , and
  9. , frequencies: , , , and
  10. , frequencies: , , , and

Our maximal frequency is , and the integers , , and all have this frequency. Because more than one integer has this frequency, we choose the smallest one, which is . We then print the respective smallest number having the maximal frequency and the maximal frequency as a single line of space-separated values.

Line: 1 Col: 1
  1. Challenge Walkthrough
    Let's walk through this sample challenge and explore the features of the code editor.1 of 6
  2. Review the problem statement
    Each challenge has a problem statement that includes sample inputs and outputs. Some challenges include additional information to help you out.2 of 6
  3. Choose a language
    Select the language you wish to use to solve this challenge.3 of 6
  4. Enter your code
    Code your solution in our custom editor or code in your own environment and upload your solution as a file.4 of 6
  5. Test your code
    You can compile your code and test it for errors and accuracy before submitting.5 of 6
  6. Submit to see results
    When you're ready, submit your solution! Remember, you can go back and refine your code anytime.6 of 6
  1. Check your score