#t115. 奇偶校验
奇偶校验
Parity Check
Problem Description
Data may be corrupted during transmission, so the receiver usually verifies whether the received data is correct. Parity checking is one of the classic verification methods.
You are given non-negative integers representing the transmitted data. Their check code depends on the parity of the total number of -bits (in binary) among these integers: if the integers have an odd total number of -bits, the check code is ; otherwise it is . Can you compute the check code of these integers?
Input Format
The first line contains a positive integer , the amount of transmitted data.
The second line contains non-negative integers , the transmitted data.
Output Format
Output one line containing two integers separated by a single space:
- the first integer is the total number of -bits (in binary) among ;
- the second integer is the check code ( or ).
Sample Input 1
4
71 69 83 80
Sample Input 2
6
1 2 4 8 16 32
Sample Output 1
13 1
Sample Output 2
6 0
Sample Explanation
For the first sample, the input consists of integers: . Count the -bits of each in binary:
- , which contains ones.
- , which contains ones.
- , which contains ones.
- , which contains ones.
The total number of -bits is , which is odd. Therefore the check code is , and the final output is 13 1.
Constraints
For all test cases, , .