import java io import java util public class Solution public static vo

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int T = Integer.parseInt(br.readLine());
while(T != 0){
int ans = 0;
int Q = Integer.parseInt(br.readLine());
HashSet<Integer> hs = new HashSet<Integer>();
while(Q != 0){
HashSet<Integer> newelems = new HashSet<Integer>();
int q = Integer.parseInt(br.readLine());
hs.add(q);
for(int num : hs){
if(num != q)
newelems.add(q^num);
}
hs.addAll(newelems);
printResult(hs);
Q--;
}
T--;
}
}
public static void printResult(HashSet<Integer> s){
int even = 0, odd = 0;
for(int num : s){
int c = 0;
while(num != 0){
if((num & 1) == 1)
c++;
num = num >> 1;
}
if(c % 2 == 0)
even++;
else
odd++;
}
System.out.print(even+" "+odd + "\n");
}
}