Alexandra has an even-length array $a$, consisting of $0$s and $1$s. The elements of the array are enumerated from $1$ to $n$. She wants to remove at most $\frac{n}{2}$ elements (where $n$ — length of array) in the way that alternating sum of the array will be equal $0$ (i.e. $a_1 - a_2 + a_3 - a_4 + \dotsc = 0$). In other words, Alexandra wants sum of all elements at the odd positions and sum of all elements at the even positions to become equal. The elements that you remove don't have to be consecutive.

For example, if she has $a = [1, 0, 1, 0, 0, 0]$ and she removes $2$nd and $4$th elements, $a$ will become equal $[1, 1, 0, 0]$ and its alternating sum is $1 - 1 + 0 - 0 = 0$.

Help her!


-----Input-----

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^3$). Description of the test cases follows.

The first line of each test case contains a single integer $n$ ($2 \le n \le 10^3$, $n$ is even)  — length of the array.

The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ ($0 \le a_i \le 1$)  — elements of the array.

It is guaranteed that the sum of $n$ over all test cases does not exceed $10^3$.


-----Output-----

For each test case, firstly, print $k$ ($\frac{n}{2} \leq k \leq n$) — number of elements that will remain after removing in the order they appear in $a$. Then, print this $k$ numbers. Note that you should print the numbers themselves, not their indices.

We can show that an answer always exists. If there are several answers, you can output any of them. 


-----Example-----
Input
4
2
1 0
2
0 0
4
0 1 1 1
4
1 1 0 0

Output
1
0
1
0
2
1 1
4
1 1 0 0



-----Note-----

In the first and second cases, alternating sum of the array, obviously, equals $0$.

In the third case, alternating sum of the array equals $1 - 1 = 0$.

In the fourth case, alternating sum already equals $1 - 1 + 0 - 0 = 0$, so we don't have to remove anything.

Difficulty: EASY

Solutions:
for t in range(int(input())):
	n = int(input())
	m = list(map(int, input().split()))
	if sum(m) <= n // 2:
		print(m.count(0))
		print('0 ' * m.count(0))
	elif sum(m) % 2 == 0:
		print(m.count(1))
		print('1 ' * m.count(1))
	else:
		print(m.count(1) - 1)
		print('1 ' * (m.count(1) - 1))


def run_test():
	n = int(input())
	a = list(map(int, input().split()))
	n_0 = sum((1 for x in a if x == 0))
	res = []
	if n_0 < n // 2:
		res = [x for x in a if x == 1]
		if len(res) % 2 == 1:
			res.pop()
	else:
		res = [x for x in a if x == 0]
	print(len(res))
	print(' '.join(map(str, res)))

def main():
	t = int(input())
	for _ in range(t):
		run_test()
main()


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	c1 = l.count(1)
	c2 = l.count(0)
	if c1 <= c2:
		print(c2)
		l = [0] * c2
		print(*l)
	elif c1 % 2:
		print(c1 - 1)
		l = [1] * (c1 - 1)
		print(*l)
	else:
		print(c1)
		l = [1] * c1
		print(*l)


from sys import stdin, stdout
t = int(stdin.readline())
for case in range(t):
	n = int(stdin.readline())
	arr = list(map(int, stdin.readline().split()))
	(one, zero) = (0, 0)
	for item in arr:
		if item == 0:
			zero += 1
		else:
			one += 1
	if one > zero:
		one = one - one % 2
		stdout.write('{}\n'.format(one))
		stdout.write(' '.join(['1'] * one))
	else:
		stdout.write('{}\n'.format(zero))
		stdout.write(' '.join(['0'] * zero))
	stdout.write('\n')


t = int(input())
for _ in range(t):
	l = int(input())
	arr = input().split()
	count_0 = 0
	count_1 = 0
	for i in arr:
		if i == '1':
			count_1 += 1
		else:
			count_0 += 1
	if count_0 >= count_1:
		print(count_0)
		for i in range(count_0 - 1):
			print(0, end=' ')
		print(0)
	elif count_1 > count_0:
		print(count_1 // 2 * 2)
		for i in range(count_1 // 2 * 2 - 1):
			print(1, end=' ')
		print(1)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	(cz, co) = (0, 0)
	for i in arr:
		if i:
			co += 1
		else:
			cz += 1
	if cz >= co:
		print(cz)
		print('0 ' * cz)
	else:
		co = co - 1 if co % 2 else co
		print(co)
		print('1 ' * co)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def solve(arr, n):
	cnt1 = 0
	cnt0 = 0
	for i in range(n):
		if arr[i] == 0:
			cnt0 += 1
		if arr[i] == 1:
			cnt1 += 1
	if cnt1 <= n // 2:
		print(n - cnt1)
		for i in range(n - cnt1):
			print(0, end=' ')
	else:
		if cnt0 < n // 2 and cnt1 % 2 == 1:
			print(n - cnt0 - 1)
			for i in range(cnt1 - 1):
				print(1, end=' ')
		if cnt0 < n // 2 and cnt1 % 2 == 0:
			print(n - cnt0)
			for i in range(cnt1):
				print(1, end=' ')
t = inp()
while t > 0:
	n = inp()
	arr = inlt()
	solve(arr, n)
	print()
	t -= 1


a = int(input())
for i in range(0, a):
	i = int(input())
	j = list(map(int, input().split()))
	l = j.count(1)
	o = j.count(0)
	if l > o:
		if l % 2 == 1:
			l -= 1
		print(l)
		print('1 ' * l)
	else:
		print(o)
		print('0 ' * o)


for u in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	(x, y) = (l.count(1), l.count(0))
	d = []
	if x > y:
		for i in range(0, n, 2):
			if l[i] != l[i + 1]:
				d.append(1)
			elif l[i] == l[i + 1] == 1:
				d.append(l[i])
				d.append(l[i + 1])
		if len(d) % 2 == 1:
			print(len(d) - 1)
			print(*d[:len(d) - 1])
		else:
			print(len(d))
			print(*d)
	else:
		for i in range(0, n, 2):
			if l[i] != l[i + 1]:
				d.append(0)
			elif l[i] == l[i + 1] == 0:
				d.append(l[i])
				d.append(l[i + 1])
		print(len(d))
		print(*d)


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	arr = input().split()
	counter = Counter(arr)
	if counter['0'] >= n / 2:
		print(counter['0'])
		print(*[0] * counter['0'], sep=' ')
	elif counter['1'] % 2 == 0:
		print(counter['1'])
		print(*[1] * counter['1'], sep=' ')
	else:
		print(counter['1'] - 1)
		print(*[1] * (counter['1'] - 1), sep=' ')


t = int(input())
while t != 0:
	n = int(input())
	a = list(map(int, input().split()))[:n]
	num_1 = a.count(1)
	num_0 = a.count(0)
	if num_1 <= n // 2:
		ans = [0] * num_0
		print(len(ans))
		print(*ans)
	elif num_1 > n // 2 and num_1 % 2 == 0:
		ans = [1] * num_1
		print(len(ans))
		print(*ans)
	else:
		ans = [1] * (num_1 - 1)
		print(len(ans))
		print(*ans)
	t -= 1


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from collections import Counter
inp = lambda : int(input())
strng = lambda : input().strip()
jn = lambda x, l: x.join(map(str, l))
strl = lambda : list(input().strip())
mul = lambda : map(int, input().strip().split())
mulf = lambda : map(float, input().strip().split())
seq = lambda : list(map(int, input().strip().split()))
ceil = lambda x: int(x) if x == int(x) else int(x) + 1
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
stdarr = lambda : map(int, stdstr().split())
mod = 1000000007
for _ in range(stdint()):
	n = stdint()
	arr = list(stdarr())
	c = Counter(arr)
	if c[1] > c[0]:
		if c[1] & 1 == 1:
			i = c[1] - 1
		else:
			i = c[1]
		x = 1
	else:
		i = c[0]
		x = 0
	print(i)
	print(*[x for __ in range(i)])


t = int(input())
while t > 0:
	n = int(input())
	arr = list(map(int, input().strip().split()))[:n]
	cnt_0 = arr.count(0)
	if cnt_0 >= n / 2:
		print(cnt_0)
		for i in range(cnt_0):
			print(0, end=' ')
	elif cnt_0 < n / 2:
		print(arr.count(1) - arr.count(1) % 2)
		for i in range(arr.count(1) - arr.count(1) % 2):
			print(1, end=' ')
	print('\t')
	t = t - 1


for _ in range(int(input())):
	n = int(input())
	li = map(int, input().split())
	one = 0
	zero = 0
	for i in li:
		if i == 1:
			one += 1
		else:
			zero += 1
	if zero >= n // 2:
		print(zero)
		for i in range(zero):
			print(0, end=' ')
		print()
	else:
		if one % 2 != 0:
			one -= 1
		print(one)
		for i in range(one):
			print(1, end=' ')
		print()


from sys import stdin

def get_int():
	return int(stdin.readline())

def get_str():
	return stdin.readline().strip()

def get_ints():
	return map(int, stdin.readline().strip().split())

def get_array():
	return list(map(int, stdin.readline().strip().split()))

def get_array2d(row):
	return [list(map(int, stdin.readline().strip().split())) for _ in range(row)]
T = get_int()
for _ in range(T):
	N = get_int()
	A = get_array()
	cnt = 0
	for a in A:
		cnt += int(a)
	d = cnt & 1
	if cnt <= N // 2:
		cnt = N - cnt
		s = 0
	else:
		cnt = cnt - d
		s = 1
	print(cnt)
	while cnt > 0:
		print(s, end=' ')
		cnt -= 1
	print()


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		n = int(input())
		arry = list(map(int, input().split()))
		count0 = 0
		count1 = 0
		for i in range(n):
			if arry[i] == 1:
				count1 += 1
			else:
				count0 += 1
		if count0 > count1:
			if count0 % 2:
				count0 -= 1
			yield count0
			yield ' '.join((str(x) for x in count0 * [0]))
		elif count0 < count1:
			if count1 % 2:
				count1 -= 1
			yield count1
			yield ' '.join((str(x) for x in count1 * [1]))
		else:
			yield count0
			yield ' '.join((str(x) for x in count0 * [0]))
t = int(input())
ans = gift()
print(*ans, sep='\n')


import collections
import math

def solve(lst):
	ones = 0
	for i in lst:
		if i == 1:
			ones += 1
	zeros = len(lst) - ones
	if ones == len(lst):
		return ['1'] * len(lst)
	elif zeros == len(lst):
		return ['0'] * len(lst)
	if zeros == ones:
		return ['0'] * zeros
	if zeros > ones:
		return ['0'] * zeros
	if ones % 2 == 0:
		return ['1'] * ones
	return ['1'] * (ones - 1)
k = int(input())
for i in range(k):
	k = int(input())
	lst = list(map(int, input().split()))
	p = solve(lst)
	print(len(p))
	print(' '.join(p))


import sys
input = sys.stdin.buffer.readline

def solution():
	n = int(input())
	l = list(map(int, input().split()))
	z = 0
	o = 0
	for i in range(n):
		if l[i] == 0:
			z += 1
		else:
			o += 1
	if o <= n // 2:
		ans = [0] * z
	else:
		ans = [1] * o
		if o % 2:
			ans.pop()
	print(len(ans))
	print(*ans)
t = int(input())
for _ in range(t):
	solution()


from sys import stdin, stdout
from collections import Counter, OrderedDict
import math
cin = stdin.readline
cout = stdout.write
mp = lambda : list(map(int, cin().split()))

def chars():
	s = cin()
	return list(s[:len(s) - 1])

def pl(a):
	for val in a:
		cout(str(val) + ' ')
	cout('\n')
(t,) = mp()
for _ in range(t):
	(n,) = mp()
	a = mp()
	C = Counter(a)
	if C[0] >= n // 2:
		cout(str(C[0]) + '\n')
		pl([0] * C[0])
	elif C[1] >= n // 2:
		if C[1] % 2 == 0:
			cout(str(C[1]) + '\n')
			pl([1] * C[1])
		elif C[1] - 1 >= n // 2:
			cout(str(C[1] - 1) + '\n')
			pl([1] * (C[1] - 1))


import math
import collections
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect_left as bsl
from bisect import bisect_right as bsr
import heapq as hq
setrecursionlimit(2 ** 20)
t = 1
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().rstrip().split()))
	(c1, c0) = (0, 0)
	for i in range(n):
		if a[i] == 1:
			c1 += 1
		else:
			c0 += 1
	l = 0
	chk = False
	if c0 >= c1:
		print(c0)
		for i in range(c0):
			print(0, end=' ')
		print()
		continue
	else:
		if c1 % 2 == 1:
			c1 -= 1
		print(c1)
		for i in range(c1):
			print(1, end=' ')
		print()
		continue


import sys
from math import *
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if a.count(0) >= a.count(1):
		print(a.count(0))
		print(*[0] * a.count(0))
	else:
		k = a.count(1) if not a.count(1) & 1 else a.count(1) - 1
		print(k)
		print(*[1] * k)


a = int(input())
for i in range(a):
	b = int(input())
	l = list(map(int, input().split()))
	c = 0
	co = 0
	for j in range(b):
		if l[j] == 1:
			c += 1
	co = b - c
	if co >= b // 2:
		print(co)
		print(*[0] * co)
	else:
		c = c - c % 2
		print(c)
		print(*[1] * c)


t = int(input())
for _ in range(t):
	n = int(input())
	tab = list(map(int, input().split()))
	ones = sum(tab)
	zeros = len(tab) - ones
	if ones <= n / 2:
		print(zeros)
		for i in range(zeros):
			print('0 ', end='')
		print('')
	else:
		print(ones // 2 * 2)
		for i in range(ones // 2 * 2):
			print('1 ', end='')
		print('')


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	suma = sum(a)
	if suma <= n // 2:
		print(n - suma)
		for i in range(n - suma):
			print(0, end=' ')
	else:
		k = n // 2
		if k % 2 == 1:
			k += 1
		print(k)
		for i in range(k):
			print(1, end=' ')
	print()


import collections
t = int(input())
for _ in range(t):
	n = int(input())
	arr = [*map(int, input().split())]
	counter = collections.Counter(arr)
	if counter[0] >= n // 2:
		print(counter[0])
		print(' '.join(['0'] * counter[0]))
	elif n // 2 % 2 == 0:
		print(n // 2)
		print(' '.join(['1'] * (n // 2)))
	else:
		print(n // 2 + 1)
		print(' '.join(['1'] * (n // 2 + 1)))


for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	zero = l.count(0)
	one = l.count(1)
	ans = []
	if zero == one:
		if zero == 1:
			ans.append(0)
		elif zero % 2 == 0:
			ans = [0] * zero
		else:
			f = -1
			(zerocount, onecount) = (0, 0)
			for i in l:
				if i == 0:
					zerocount += 1
				else:
					onecount += 1
				if zerocount == zero - 1:
					f = 0
					break
				elif onecount == one - 1:
					f = 1
					break
			if f == 0:
				ans = [0] * (zero - 1)
				ans.append(1)
				ans.append(1)
			elif f == 1:
				ans = [1] * (one - 1)
				ans.append(0)
				ans.append(0)
	elif zero > one:
		if zero % 2 == 0:
			ans = [0] * zero
		else:
			ans = [0] * (zero - 1)
	elif one % 2 == 0:
		ans = [1] * one
	else:
		ans = [1] * (one - 1)
	print(len(ans))
	for i in ans:
		print(i, end=' ')
	print()


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	c0 = a.count(0)
	c1 = a.count(1)
	if c1 > c0:
		if c1 % 2 == 1:
			c1 -= 1
		print(c1)
		print('1 ' * c1)
	else:
		print(c0)
		print('0 ' * c0)


from __future__ import division, print_function
import sys
sys.setrecursionlimit(10 ** 4)
from sys import stdin, stdout
import bisect
import math
import heapq
i_m = 9223372036854775807

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
import math

def GCD(x, y):
	x = abs(x)
	y = abs(y)
	if min(x, y) == 0:
		return max(x, y)
	while y:
		(x, y) = (y, x % y)
	return x

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l
prime = []

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f

def primeFactors(n):
	a = []
	while n % 2 == 0:
		a.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			a.append(i)
			n = n // i
	if n > 2:
		a.append(n)
	return a

def main():
	t = inin()
	for _ in range(t):
		n = inin()
		a = ain()
		x = 0
		for i in a:
			if i == 0:
				x += 1
		y = n - x
		b = []
		if x < y:
			if y % 2 == 1:
				y -= 1
			print(y)
			print(*[1] * y)
		else:
			print(x)
			print(*[0] * x)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def readnumbers(zero=0):
	conv = ord if py2 else lambda x: x
	A = []
	numb = zero
	sign = 1
	i = 0
	s = sys.stdin.buffer.read()
	try:
		while True:
			if s[i] >= b'R'[0]:
				numb = 10 * numb + conv(s[i]) - 48
			elif s[i] == b'-'[0]:
				sign = -1
			elif s[i] != b'\r'[0]:
				A.append(sign * numb)
				numb = zero
				sign = 1
			i += 1
	except:
		pass
	if s and s[-1] >= b'R'[0]:
		A.append(sign * numb)
	return A
main()


from sys import stdin, stdout
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	x = list(map(int, stdin.readline().split()))
	count1 = x.count(1)
	count0 = x.count(0)
	if count1 > count0:
		count1 = count1 - count1 % 2
		print(count1)
		for i in range(count1):
			print(1, end=' ')
	else:
		print(count0)
		for i in range(count0):
			print(0, end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = [0] * 2
	for i in a:
		b[i] += 1
	if b[1] * 2 <= n:
		k = b[0]
		ans = [0] * k
	else:
		k = b[1]
		if k % 2:
			k -= 1
		ans = [1] * k
	print(k)
	print(*ans)


import sys
input = sys.stdin.readline
t = int(input())
for tests in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	ZERO = A.count(0)
	if ZERO >= n // 2:
		print(ZERO)
		print(*[0] * ZERO)
	else:
		ONE = n - ZERO
		print(ONE // 2 * 2)
		print(*[1] * (ONE // 2 * 2))


import math as mt

def tran(arr):
	z = arr.count(0)
	o = arr.count(1)
	if z >= o:
		return [0] * z
	elif o % 2 == 0:
		return [1] * o
	else:
		return [1] * (o - 1)
t = int(input())
ans = []
for i in range(t):
	n = int(input())
	arr = list(map(int, input().rstrip().split()))
	r = tran(arr)
	ans.append(r)
for i in ans:
	print(len(i))
	print(*i)


t = int(input())
for c in range(t):
	n = int(input())
	arr = [int(x) for x in input().split(' ')]
	oc_0 = arr.count(0)
	oc_1 = arr.count(1)
	if oc_0 >= oc_1:
		print(oc_0)
		for i in range(oc_0):
			print('0', end=' ')
		print()
	else:
		print(2 * (oc_1 // 2))
		for i in range(2 * (oc_1 // 2)):
			print('1', end=' ')
		print()


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	ar = list(map(int, input().split()))
	cntr = Counter(ar)
	if n / 2 >= cntr[1]:
		print(cntr[0])
		print(*[0] * cntr[0])
	elif n == 3:
		print(2)
		print(*[1, 1])
	elif cntr[1] - cntr[0] != 1:
		print(cntr[1] - cntr[1] % 2)
		print(*[1] * (cntr[1] - cntr[1] % 2))
	elif ar[0] == 0:
		print(cntr[1])
		print(*[0] + [1] * (cntr[1] - 1))
	elif ar[-1] == 0:
		print(cntr[1])
		print(*[1] * (cntr[1] - 1) + [0])
	else:
		print(cntr[1] + 1)
		print(*[1] + [0] * cntr[0] + [1])


def find_num(n, n_list):
	answer_arr = []
	count = 0
	for i in range(n):
		if not n_list[i]:
			count += 1
	count_1 = n - count
	if count >= n // 2:
		answer_arr.append(count)
		for i in range(count):
			answer_arr.append(0)
	else:
		temp = count_1 - count_1 % 2
		answer_arr.append(temp)
		for i in range(temp):
			answer_arr.append(1)
	return answer_arr
t = int(input())
temp_a = [[]]
ans_a = []
for i in range(t):
	n = int(input())
	n_list = list(map(int, input().split()))
	ans_a = find_num(n, n_list)
	temp_a.append(ans_a)
del temp_a[0]
for r in range(len(temp_a)):
	print(temp_a[r][0])
	for c in range(1, len(temp_a[r])):
		print(temp_a[r][c], end=' ')
	print()


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	c = 0
	for j in a:
		if j == 1:
			c += 1
	if c <= n / 2:
		print(n - c)
		print('0 ' * (n - c - 1) + '0')
	elif c % 2 == 0:
		print(c)
		print('1 ' * (c - 1) + '1')
	else:
		print(c - 1)
		print('1 ' * (c - 2) + '1')


t = int(input())
for i in range(t):
	n = int(input())
	s = list(map(int, input().split()))
	zero = 0
	one = 0
	for i in range(n):
		if s[i] == 1:
			one += 1
		else:
			zero += 1
	if zero >= one:
		print(zero)
		for i in range(zero):
			print(0, end=' ')
		print('\t')
	else:
		if one % 2 != 0:
			one -= 1
		print(one)
		for i in range(one):
			print(1, end=' ')
		print('\t')


import sys, collections
mod = 10 ** 9 + 7
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))
for _ in range(inp()):
	n = inp()
	a = inpl()
	c = [0, 0]
	for x in a:
		c[x] += 1
	if c[0] >= c[1]:
		print(c[0])
		print(*[0] * c[0])
	else:
		if c[1] % 2:
			c[1] -= 1
		print(c[1])
		print(*[1] * c[1])


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	ones = arr.count(1)
	zeros = arr.count(0)
	ch = '0'
	if zeros == ones:
		print(n // 2)
		print(' '.join(['0' for x in range(n // 2)]))
		continue
	if ones > zeros:
		ch = '1'
	c = n // 2 if n // 2 % 2 == 0 else n // 2 + 1
	print(c)
	print(' '.join([str(ch) for x in range(c)]))


iter = int(input())
for _ in range(iter):
	n = int(input())
	a = list(map(int, input().split(' ')))
	count = 0
	for i in range(n):
		if a[i] == 0:
			count += 1
	if count >= n // 2:
		print(count)
		print('0 ' * count)
	elif count & 1:
		print(n - count - 1)
		print('1 ' * (n - count - 1))
	else:
		print(n - count)
		print('1 ' * (n - count))


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	evenSum = 0
	oddSum = 0
	OI = []
	ZI = []
	for i in range(1, n + 1):
		if arr[i - 1] == 0:
			ZI.append(i - 1)
		if arr[i - 1] == 1:
			OI.append(i - 1)
		if i % 2 == 1:
			oddSum += arr[i - 1]
		else:
			evenSum += arr[i - 1]
	if len(ZI) >= n / 2:
		print(len(ZI))
		print('0 ' * len(ZI))
	else:
		g = len(OI) - len(OI) % 2
		print(g)
		print('1 ' * g)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(cnt1, cnt0) = (a.count(1), a.count(0))
	if cnt1 <= n / 2:
		print(cnt0)
		for _ in range(cnt0):
			print(0, end=' ')
	else:
		if cnt1 % 2 == 1:
			cnt1 -= 1
			print(cnt1)
		else:
			print(cnt1)
		for _ in range(cnt1):
			print(1, end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	c1 = l.count(1)
	c0 = l.count(0)
	if c1 == 0:
		print(n)
		print(*l)
	elif c0 == 0:
		print(n)
		print(*l)
	elif c1 > c0:
		if c1 % 2 == 0:
			print(n - c0)
			k = []
			for i in range(n - c0):
				k.append(1)
			print(*k)
		elif n // 2 % 2 != 0:
			print(n // 2 + 1)
			k = []
			for i in range(n // 2 + 1):
				k.append(1)
			print(*k)
		else:
			print(n // 2)
			k = []
			for i in range(n // 2):
				k.append(1)
			print(*k)
	else:
		print(n // 2)
		k = []
		for i in range(n // 2):
			k.append(0)
		print(*k)


N = int(input())
for i in range(N):
	n = int(input())
	a = list(map(int, input().split()))
	one_cnt = sum(a)
	zero_cnt = n - one_cnt
	if zero_cnt >= one_cnt:
		print(zero_cnt)
		for _ in range(zero_cnt):
			print(0, end=' ')
	else:
		if one_cnt % 2 == 1:
			one_cnt -= 1
		print(one_cnt)
		for _ in range(one_cnt):
			print(1, end=' ')
	print()


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
import threading
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	z = a.count(0)
	one = a.count(1)
	if one <= n // 2:
		print(n - one)
		print(*[0] * (n - one), sep=' ')
	else:
		c = n // 2
		if n // 2 % 2 == 1:
			c += 1
		print(c)
		for i in range(n):
			if a[i] == 1:
				if c > 0:
					c -= 1
					print(a[i], end=' ')
		print()


for _ in range(int(input())):
	N = int(input())
	a = list(map(int, input().split()))
	one = a.count(1)
	two = a.count(0)
	if one <= N // 2:
		a = list(filter(lambda a: a != 1, a))
		print(len(a))
		print(*a)
	elif two <= N // 2:
		a = list(filter(lambda a: a != 0, a))
		if a.count(1) % 2 == 1:
			a.remove(1)
		print(len(a))
		print(*a)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	(x, y) = (0, 0)
	for i in a:
		if i == 0:
			y += 1
		else:
			x += 1
	if x <= n / 2:
		print(y)
		for i in range(y):
			print(0, end=' ')
		print()
	else:
		if x % 2 == 1:
			x -= 1
		print(x)
		for i in range(x):
			print(1, end=' ')
		print()


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	half = int(n / 2)
	if a.count(0) >= half:
		print(a.count(0))
		for i in a:
			if i == 0:
				print(str(i) + ' ', end='')
	else:
		ones = a.count(1)
		how_many_ones = 0
		if ones % 2 == 0:
			print(ones)
			for i in a:
				if i == 1:
					print(str(i) + ' ', end='')
		else:
			print(ones - 1)
			for i in a:
				if i == 1 and how_many_ones < ones - 1:
					print(str(i) + ' ', end='')
					how_many_ones += 1
	print('')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	c0 = 0
	c1 = 0
	for i in range(n):
		if arr[i] == 1:
			c1 += 1
		else:
			c0 += 1
	if c0 >= c1:
		print(c0)
		print(*[0] * c0)
	else:
		if c1 % 2 != 0:
			c1 -= 1
		print(c1)
		print(*[1] * c1)


import sys
import math
import collections
from sys import stdin, stdout, setrecursionlimit
import bisect as bs
setrecursionlimit(2 ** 20)
M = 10 ** 9 + 7
T = int(stdin.readline())
for _ in range(T):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	n1 = 0
	for i in range(n):
		if a[i] == 1:
			n1 += 1
	if n1 <= n // 2:
		print(n - n1)
		for i in range(n - n1):
			print(0, end=' ')
		print('')
		continue
	n1 = n1 - n1 % 2
	print(n1)
	for i in range(n1):
		print(1, end=' ')
	print('')


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	x = 0
	y = 0
	for i in a:
		if i == 0:
			x += 1
		else:
			y += 1
	if x >= n // 2:
		print(x)
		for i in range(x):
			print(0, end=' ')
	else:
		if y % 2:
			y -= 1
		print(y)
		for i in range(y):
			print(1, end=' ')
	print()


(T,) = map(int, input().split())
for i in range(T):
	(N,) = map(int, input().split())
	X = list(map(int, input().split()))
	c = sum(X)
	if 2 * c <= N:
		print(N - c)
		print(*[0] * (N - c))
	elif c % 2:
		print(c - 1)
		print(*[1] * (c - 1))
	else:
		print(c)
		print(*[1] * c)


for _ in range(int(input())):
	n = int(input())
	lst = input().split()
	one = lst.count('1')
	zero = lst.count('0')
	if one > zero:
		lst = list(filter(lambda x: x == '1', lst))
		if len(lst) % 2 == 0:
			print(len(lst))
			print(' '.join(lst))
		else:
			lst.pop()
			print(len(lst))
			print(' '.join(lst))
	else:
		lst = list(filter(lambda x: x == '0', lst))
		print(len(lst))
		print(' '.join(lst))


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		arr = [int(x) for x in input().split()]
		count = 0
		for i in range(n):
			if arr[i] == 0:
				count += 1
		if count >= n // 2:
			print(count)
			answer = ' '.join(['0'] * count)
		elif (n - count) % 2 == 0:
			print(n - count)
			answer = ' '.join(['1'] * (n - count))
		else:
			print(n - count - 1)
			answer = ' '.join(['1'] * (n - count - 1))
		print(answer)
main()


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	A = list(map(int, input().split(' ')))
	if A.count(1) <= n // 2:
		print(A.count(0))
		for i in range(n):
			if A[i] == 0:
				print(A[i], end=' ')
		print()
	elif A.count(1) % 2 == 0:
		print(A.count(1))
		for i in range(n):
			if A[i] == 1:
				print(A[i], end=' ')
		print()
	else:
		c = 0
		print(A.count(1) - 1)
		for i in range(n):
			if A[i] == 1 and c > 0:
				print(A[i], end=' ')
			if A[i] == 1:
				c += 1
		print()


T = int(input())
for _ in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	ones = sum(a)
	z = n - ones
	if ones == n or ones == 0:
		print(n)
		for i in range(n):
			print(a[i], end=' ')
	elif ones <= n // 2:
		print(z)
		for i in range(z):
			print(0, end=' ')
	else:
		if ones % 2 != 0:
			ones -= 1
		print(ones)
		for i in range(ones):
			print(1, end=' ')
	print()


from collections import Counter
x = int(input())
for _ in range(x):
	n = int(input())
	nums = [int(num) for num in input().split(' ')]
	map_ = Counter(nums)
	if map_[1] <= n // 2:
		print(map_[0])
		print('0 ' * map_[0])
	else:
		print(map_[1] - map_[1] % 2)
		print('1 ' * (map_[1] - map_[1] % 2))


for t in range(int(input())):
	num = int(input())
	arr = list(map(int, input().split()))
	ones = arr.count(1)
	zeros = arr.count(0)
	if zeros >= num // 2:
		print(zeros)
		for i in range(num):
			if arr[i] == 0:
				print(0, end=' ')
	else:
		if ones % 2 != 0:
			ones -= 1
		print(ones)
		count = 0
		for i in range(num):
			if arr[i] == 1:
				print(1, end=' ')
				count += 1
				if count == ones:
					break
	print('')


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	one = a.count(1)
	if one % 2 == 1:
		one -= 1
	zero = a.count(0)
	ans = []
	if one > zero:
		for i in range(one):
			ans.append(1)
	else:
		for i in range(zero):
			ans.append(0)
	print(len(ans))
	print(*ans)


try:
	for _ in range(int(input())):
		n = int(input())
		l = list(map(int, input().split()))
		c = l.count(1)
		d = l.count(0)
		if c > d:
			if c % 2 == 0:
				print(c)
				print(*[1] * c, sep=' ')
			else:
				print(c - 1)
				print(*[1] * (c - 1), sep=' ')
		else:
			print(d)
			print(*[0] * d, sep=' ')
except:
	pass


import math

def MI():
	return map(int, input().split())

def ML():
	return list(MI())

def I():
	return int(input())

def LOOP(SizE, solve):
	for XIX in range(SizE):
		solve()

def solve():
	n = I()
	a = ML()
	nd = {0: 0, 1: 0}
	for x in a:
		nd[x] += 1
	if nd[1] * 2 <= n:
		res = [0 for x in range(nd[0])]
	else:
		if nd[1] & 1:
			nd[1] -= 1
		res = [1 for x in range(nd[1])]
	print(len(res))
	print(*res)
LOOP(I(), solve)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	ans = []
	c0 = 0
	c1 = 0
	for i in l:
		if i == 0:
			c0 = c0 + 1
		else:
			c1 = c1 + 1
	if c1 % 2 == 0 and c0 % 2 == 0:
		if c1 <= n // 2:
			print(c0)
			for i in range(c0):
				print('0', end=' ')
			print()
		else:
			print(c1)
			for i in range(c1):
				print('1', end=' ')
			print()
	elif c1 == 1 and c0 == 1:
		print(1)
		print(0)
	elif c0 >= c1:
		print(c0)
		for i in range(c0):
			print(0, end=' ')
		print()
	else:
		print(c1 - 1)
		for i in range(c1 - 1):
			print(1, end=' ')
		print()


import math, queue, heapq
import sys
sys.setrecursionlimit(10 ** 6)
fastinput = sys.stdin.readline
fastout = sys.stdout.write
t = int(fastinput())
while t:
	t -= 1
	n = int(fastinput())
	a = list(map(int, fastinput().split()))
	c = a.count(1)
	if c == 0 or c == n:
		print(n)
		print(*a)
	elif c <= n // 2:
		print(n - c)
		print('0 ' * (n - c))
	elif c % 2 == 0:
		print(c)
		print('1 ' * c)
	else:
		c -= 1
		print(c)
		print('1 ' * c)


n = int(input())
i = 0
while i < n:
	q = int(input())
	mas = input()
	if mas.count('0') < mas.count('1'):
		mas = mas.replace(' 0', '')
		mas = mas.replace('0 ', '')
		if mas.count('1') % 2 == 1:
			mas = mas[2:]
	else:
		mas = mas.replace(' 1', '')
		mas = mas.replace('1 ', '')
	mas = mas.strip()
	print(len(mas.split()))
	print(mas)
	i += 1


t = int(input())
while t != 0:
	n = int(input())
	a = list(map(int, input().split()))[:n]
	n_1 = a.count(1)
	if n_1 <= n // 2:
		o = a.count(0)
		ans = [0] * o
		print(o)
		print(*ans)
	elif n_1 > n // 2 and n_1 % 2 == 0:
		ans = [1] * n_1
		print(n_1)
		print(*ans)
	else:
		print(n_1 - 1)
		ans = [1] * (n_1 - 1)
		print(*ans)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().strip().split()))
	(one, zero) = (0, 0)
	for i in a:
		if i == 0:
			zero += 1
		else:
			one += 1
	if one <= n / 2:
		print(zero)
		for i in range(zero):
			print(0, end=' ')
		print()
	else:
		if one % 2 == 1:
			one -= 1
		print(one)
		for i in range(one):
			print(1, end=' ')
		print()


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil, pi, sin, cos, acos, atan
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
from itertools import permutations, combinations
mod = int(1000000000.0) + 7
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
out = lambda x: stdout.write(str(x) + '\n')
t = ip()
for _ in range(t):
	n = ip()
	arr = list(inp())
	ct1 = arr.count(1)
	ct0 = arr.count(0)
	if ct0 >= n // 2:
		print(ct0)
		ans = [0] * ct0
		print(*ans)
	else:
		ct1 = ct1 - ct1 % 2
		ans = [1] * ct1
		print(len(ans))
		print(*ans)


h = int(input())
for i in range(h):
	n = int(input())
	e1 = 0
	e0 = 0
	n = list(map(int, input().split()))
	for i in range(len(n)):
		if n[i] == 1:
			e1 += 1
		else:
			e0 += 1
	if e0 >= e1:
		print(e0)
		for i in range(e0):
			print(0, end=' ')
		print()
	elif e1 % 2 == 0:
		print(e1)
		for i in range(e1):
			print(1, end=' ')
		print()
	else:
		print(e1 - 1)
		for i in range(e1 - 1):
			print(1, end=' ')
		print()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s0 = 0
	s1 = 0
	for i in range(0, len(a)):
		if a[i] == 0:
			s0 += 1
		else:
			s1 += 1
	if s0 > len(a) // 2:
		print(len(a) // 2 + 1)
		print('0 ' * (len(a) // 2 + 1))
	elif s1 > len(a) // 2:
		if len(a) // 2 % 2 == 1:
			print(len(a) // 2 + 1)
			print('1 ' * (len(a) // 2 + 1))
		else:
			print(len(a) // 2)
			print('1 ' * (len(a) // 2))
	else:
		print(len(a) // 2)
		print('0 ' * (len(a) // 2))


TC = int(input())
for tc in range(TC):
	N = int(input())
	A = list(map(int, input().split()))
	if N == 2:
		if A[0] != A[1]:
			print(1)
			print(0)
		else:
			print(2)
			print(A[0], A[1])
		continue
	c0 = 0
	c1 = 0
	for a in A:
		if a == 0:
			c0 += 1
		else:
			c1 += 1
	if c0 >= c1:
		s = 0
		c = c0
	else:
		s = 1
		if c1 % 2 != 0:
			c = c1 - 1
		else:
			c = c1
	print(c)
	for r in range(c):
		print(s, end=' ')
	print()


import sys
import itertools
import math
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(m,) = I()
while m:
	m -= 1
	(n,) = I()
	arr = I()
	c = 0
	z = o = 0
	for i in range(n):
		if arr[i] == 0:
			z += 1
		else:
			o += 1
	if o <= n // 2:
		print(z)
		print(*[0] * z)
	elif z <= n // 2:
		if o % 2:
			print(o - 1)
			print(*[1] * (o - 1))
		else:
			print(o)
			print(*[1] * o)


T = int(input())
ret = []
for t in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	count = [0] * 2
	for i in range(n):
		count[a[i]] += 1
	if count[0] < count[1]:
		le = count[1] - count[1] % 2
		ans = [le, ['1' for i in range(le)]]
	else:
		ans = [count[0], ['0' for i in range(count[0])]]
	ret.append(ans)
for t in range(T):
	print(ret[t][0])
	print(' '.join(ret[t][1]))


def solve():
	n = int(input())
	l = list(map(int, input().split()))
	(z, o) = (0, 0)
	for i in l:
		if i == 0:
			z += 1
		else:
			o += 1
	if z == n or o == n:
		return l
	if z == o:
		return [0] * z
	if z > o:
		if z % 2 == 0:
			return [0] * z
		else:
			z -= 1
			return [0] * z
	elif o % 2 == 0:
		return [1] * o
	else:
		o -= 1
		return [1] * o
for _ in range(int(input())):
	p = solve()
	print(len(p))
	print(*p)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	d = [0, 0]
	for i in arr:
		d[i] += 1
	if d[0] >= d[1]:
		print(d[0])
		print('0 ' * d[0])
	else:
		k = d[1] - d[1] % 2
		print(k)
		print('1 ' * k)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	cnt0 = 0
	cnt1 = 0
	for val in a:
		if val == 0:
			cnt0 += 1
		else:
			cnt1 += 1
	if cnt0 >= cnt1:
		print(cnt0)
		print('0 ' * cnt0)
	elif cnt1 % 2 == 0:
		print(cnt1)
		print('1 ' * cnt1)
	else:
		print(cnt1 - 1)
		print('1 ' * (cnt1 - 1))


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	cone = sum(a)
	czero = n - cone
	if cone <= n // 2:
		print(czero)
		print(*[0] * czero)
	elif cone % 2 == 0:
		print(cone)
		print(*[1] * cone)
	else:
		print(cone - 1)
		print(*[1] * (cone - 1))


testCases = int(input())
for i in range(testCases):
	zeroCount = 0
	oneCount = 0
	n = int(input())
	input1 = list(map(int, input().split(' ')))
	for i in range(0, n):
		if input1[i] == 1:
			oneCount += 1
		else:
			zeroCount += 1
	if oneCount <= n / 2:
		print(zeroCount)
		for i in range(0, zeroCount):
			print('0 ', end='')
		print()
	else:
		var = oneCount // 2 * 2
		print(var)
		for i in range(0, var):
			print('1 ', end='')
		print()


def f(ayes):
	n = len(ayes)
	cnt1 = len([a for a in ayes if a])
	cnt0 = n - cnt1
	if cnt1 <= n // 2:
		return [0 for _ in range(cnt0)]
	else:
		return [1 for _ in range(cnt1 - cnt1 % 2)]
t = int(input())
for _ in range(t):
	_ = int(input())
	result = f([int(a) for a in input().split()])
	print(len(result))
	print(' '.join([str(x) for x in result]))


import math, sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda : int(input())
li = lambda : list(map(int, input().split()))

def solve():
	n = I()
	a = li()
	c = 0
	d = 0
	for i in range(n):
		if a[i]:
			c += 1
		else:
			d += 1
	if c > d:
		print(c - c % 2)
		c -= c % 2
		for i in range(n):
			if a[i] and c:
				c -= 1
				print(a[i], end=' ')
	else:
		print(d)
		for i in range(n):
			if not a[i]:
				print(a[i], end=' ')
	print()
for _ in range(I()):
	solve()


for _ in range(int(input())):
	n = int(input())
	arr = [int(x) for x in input().split()]
	ic = 0
	oc = 0
	for i in arr:
		if i == 1:
			ic += 1
		else:
			oc += 1
	if ic > oc:
		if ic % 2 == 0:
			print(ic)
			print('1 ' * ic)
		else:
			print(ic - 1)
			print('1 ' * (ic - 1))
	else:
		print(oc)
		print('0 ' * oc)


t = int(input())
for i in range(t):
	n = int(input())
	k = list(map(int, input().split(' ')))
	if sum(k) <= n // 2:
		print(n - sum(k))
		print('0 ' * (n - sum(k)))
	elif sum(k) > n // 2:
		if n // 2 % 2 == 0:
			print(n // 2)
			print('1 ' * (n // 2))
		else:
			print(n // 2 + 1)
			print('1 ' * (n // 2 + 1))


from bisect import bisect_left
import os
import sys
from io import BytesIO, IOBase
from collections import Counter, defaultdict
from collections import deque
from functools import cmp_to_key
import math
import heapq

def sin():
	return input()

def ain():
	return list(map(int, sin().split()))

def sain():
	return input().split()

def iin():
	return int(sin())
MAX = float('inf')
MIN = float('-inf')
MOD = 1000000007

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	s = set()
	for p in range(2, n + 1):
		if prime[p]:
			s.add(p)
	return s

def readTree(n, m):
	adj = [deque([]) for _ in range(n + 1)]
	for _ in range(m):
		(u, v) = ain()
		adj[u].append(v)
		adj[v].append(u)
	return adj

def main():
	for _ in range(iin()):
		n = iin()
		a = ain()
		cz = 0
		co = 0
		for i in a:
			if i == 0:
				cz += 1
			else:
				co += 1
		if cz >= n // 2:
			print(cz)
			l = [0] * cz
		elif co % 2 == 1:
			l = [1] * (co - 1)
			print(co - 1)
		else:
			l = [1] * co
			print(co)
		print(*l)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
if os.getcwd() == 'D:\\code':
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	o = 0
	for i in a:
		if i == 1:
			o += 1
	if o > n - o:
		if o % 2 == 0:
			print(o)
			print(*[1] * o)
		else:
			print(o - 1)
			print(*[1] * (o - 1))
	else:
		print(n - o)
		print(*[0] * (n - o))


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	zero = arr.count(0)
	one = n - zero
	if one * 2 <= n:
		print(zero)
		print(*[0] * zero)
	else:
		if one % 2 == 1:
			one -= 1
		print(one)
		print(*[1] * one)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	x = 0
	ones = a.count(1)
	if ones <= n / 2:
		print(n - ones)
		print(' '.join(('0' for i in range(n - ones))))
	elif ones % 2 == 0:
		print(ones)
		print(' '.join(('1' for i in range(ones))))
	else:
		print(ones - 1)
		print(' '.join(('1' for i in range(ones - 1))))


from queue import PriorityQueue
for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	(o, z) = (0, 0)
	for i in ar:
		if i == 0:
			z += 1
		else:
			o += 1
	p = n // 2
	if p % 2 == 0:
		if z > o:
			print(z)
			print('0 ' * z)
		elif o > z:
			print(p)
			print('1 ' * p)
		else:
			print(z)
			print('0 ' * z)
	elif z > o:
		print(z)
		print('0 ' * z)
	elif o > z:
		print(p + 1)
		print('1 ' * (p + 1))
	elif z == o:
		print(z)
		print('0 ' * z)


import os
import heapq
import sys, threading
import math
import operator
from collections import defaultdict, deque
from io import BytesIO, IOBase
sys.setrecursionlimit(10 ** 5)

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def inpt():
	return [int(k) for k in input().split()]

def main():
	for _ in range(int(input())):
		n = int(input())
		ar = inpt()
		(one, zr) = (0, 0)
		for i in ar:
			if i == 1:
				one += 1
			else:
				zr += 1
		if one > zr:
			if one > 1 and one % 2 == 1:
				one -= 1
			print(one)
			print('1 ' * one)
		else:
			print(zr)
			print('0 ' * zr)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


x = int(input())
ans = []
for k in range(x):
	n = int(input())
	a = list(map(int, input().split()))
	kln = 0
	for i in range(n):
		if a[i] == 0:
			kln += 1
	if kln >= n // 2:
		ans.append([0] * kln)
	else:
		kle = 0
		for i in range(n):
			if a[i] == 1:
				kle += 1
		if kle % 2 == 1:
			ans.append([1] * (kle - 1))
		else:
			ans.append([1] * kle)
for i in range(len(ans)):
	print(len(ans[i]))
	print(*ans[i])


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	cnt = [0, 0]
	for i in range(n):
		cnt[a[i]] += 1
	take = 0 if cnt[0] >= cnt[1] else 1
	ans = []
	for i in range(n):
		if len(ans) % 2 == 0 and len(ans) >= n // 2:
			break
		if a[i] == take:
			ans.append(str(a[i]))
	print(len(ans))
	print(' '.join(ans))


t = int(input())
for _ in range(t):
	cnt0 = 0
	n = int(input())
	arr = list(map(int, input().split()))
	for i in range(n):
		if arr[i] == 0:
			cnt0 += 1
	cnt1 = n - cnt0
	if cnt0 >= n // 2:
		print(cnt0)
		for i in range(cnt0):
			print(0, end=' ')
		print()
	else:
		print(cnt1 - cnt1 % 2)
		for i in range(cnt1 - cnt1 % 2):
			print(1, end=' ')
		print()


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	s = sum(l)
	if s > n // 2:
		if s % 2 == 1:
			s -= 1
		print(s)
		print('1 ' * s)
	else:
		print(n - s)
		print('0 ' * (n - s))


t = int(input())
while t > 0:
	n = int(input())
	arr = [int(i) for i in input().split()]
	zero = one = 0
	for i in arr:
		if i == 0:
			zero += 1
		else:
			one += 1
	if one <= zero:
		print(zero)
		for i in range(zero):
			print(0, end=' ')
		print()
	elif one % 2 != 0:
		print(one - 1)
		for i in range(n):
			if arr[i] == 0:
				continue
			elif one - 1:
				print(1, end=' ')
				one -= 1
		print()
	else:
		print(one)
		for i in range(one):
			print(1, end=' ')
		print()
	t -= 1


for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	ek = li.count(1)
	sunno = n - ek
	if sunno >= n // 2:
		print(sunno)
		print(*[0] * sunno)
	else:
		ek -= ek % 2
		print(ek)
		print(*[1] * ek)


def solve(arr: list):
	ones = 0
	zeros = 0
	for i in range(len(arr)):
		if arr[i] == 1:
			ones += 1
		else:
			zeros += 1
	if ones > zeros:
		if ones % 2 != 0:
			ones -= 1
		print(ones)
		print(' '.join(['1' for _ in range(ones)]))
	else:
		print(zeros)
		print(' '.join(['0' for _ in range(zeros)]))
t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	solve(arr)


import sys
input = sys.stdin.buffer.readline

def main():
	n = int(input())
	alst = list(map(int, input().split()))
	one = alst.count(1)
	zero = alst.count(0)
	if zero * 2 >= n:
		print(zero)
		ans = [0] * zero
		print(*ans)
	elif one % 2 == 0:
		print(one)
		ans = [1] * one
		print(*ans)
	else:
		print(one - 1)
		ans = [1] * (one - 1)
		print(*ans)
for _ in range(int(input())):
	main()


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	zero = a.count(0)
	if zero >= n // 2:
		print(zero)
		print(*[0 for i in range(zero)])
	else:
		one = a.count(1)
		if one % 2:
			print(one - 1)
			print(*[1 for i in range(one - 1)])
		else:
			print(one)
			print(*[1 for i in range(one)])


import sys
from collections import defaultdict
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	z = lis.count(0)
	o = lis.count(1)
	if z >= o:
		print(z)
		print(*[0] * z)
	else:
		print(o - o % 2)
		print(*[1] * (o - o % 2))


t = int(input())
for i2 in range(t):
	n = int(input())
	dem = n
	d = 0
	d2 = 0
	a = [int(i) for i in input().split()]
	for i in a:
		if i == 0:
			d += 1
		else:
			d2 += 1
	if d >= n // 2:
		print(d)
		for i in range(d):
			print(0, end=' ')
	else:
		if d2 % 2 == 1:
			d2 -= 1
		print(d2)
		for i in range(d2):
			print(1, end=' ')
	print()


import sys
from collections import Counter

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 19
MOD = 10 ** 9 + 7
for _ in range(INT()):
	N = INT()
	A = LIST()
	C = Counter(A)
	if C[0] < C[1]:
		ans = []
		for i in range(N):
			if A[i] == 1:
				ans.append(1)
		if len(ans) % 2 == 1:
			ans.pop()
		print(len(ans))
		print(*ans)
	else:
		ans = []
		for i in range(N):
			if A[i] == 0:
				ans.append(0)
		print(len(ans))
		print(*ans)


from sys import stdin

def iinput():
	return int(stdin.readline())

def minput():
	return map(int, stdin.readline().split())

def linput():
	return list(map(int, stdin.readline().split()))
t = iinput()
while t:
	t -= 1
	n = iinput()
	a = linput()
	zeros = a.count(0)
	ones = n - zeros
	if zeros >= n // 2:
		print(zeros)
		print(*[0] * zeros)
	else:
		if ones & 1:
			ones -= 1
		print(ones)
		print(*[1] * ones)


import sys
input = sys.stdin.readline

def solve():
	n = int(input())
	L = list(map(int, input().split()))
	zero = L.count(0)
	if zero >= n / 2:
		print(zero)
		print(*[0] * zero)
		return
	one = n - zero
	print(one // 2 * 2)
	print(*[1] * (one // 2 * 2))
for _ in range(int(input())):
	solve()


for j in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	cnt0 = 0
	cnt1 = 0
	for i in range(n):
		if a[i] == 0:
			cnt0 += 1
		else:
			cnt1 += 1
	if cnt1 > cnt0:
		print(cnt1 if cnt1 % 2 == 0 else cnt1 - 1)
		for i in range(cnt1 if cnt1 % 2 == 0 else cnt1 - 1):
			print('1', end=' ')
	else:
		print(cnt0)
		for i in range(cnt0):
			print('0', end=' ')
	print()


import time, math as mt, bisect as bs, sys
from sys import stdin, stdout
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict
pi = 3.141592653589793

def II():
	return int(stdin.readline())

def IP():
	return map(int, stdin.readline().split())

def L():
	return list(map(int, stdin.readline().split()))

def P(x):
	return stdout.write(str(x) + '\n')

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def lcm(a, b):
	return a * b // gcd(a, b)

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def sieve():
	li = [True] * (2 * 10 ** 5 + 5)
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	prime = []
	for i in range(2 * 10 ** 5 + 5):
		if li[i] == True:
			prime.append(i)
	return prime

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count
mx = 10 ** 7
spf = [mx] * (mx + 1)

def SPF():
	spf[1] = 1
	for i in range(2, mx + 1):
		if spf[i] == mx:
			spf[i] = i
			for j in range(i * i, mx + 1, i):
				if i < spf[j]:
					spf[j] = i
	return

def readTree(n, e):
	adj = [set() for i in range(n + 1)]
	for i in range(e):
		(u1, u2) = IP()
		adj[u1].add(u2)
	return adj
mod = 10 ** 9 + 7

def solve():
	n = II()
	a = L()
	(cnt_0, cnt_1) = (a.count(0), a.count(1))
	if cnt_0 >= cnt_1:
		print(cnt_0)
		li = [0] * cnt_0
		print(*li)
	elif cnt_1 % 2 == 0:
		print(cnt_1)
		li = [1] * cnt_1
		print(*li)
	else:
		print(cnt_1 - 1)
		li = [1] * (cnt_1 - 1)
		print(*li)
	return
t = II()
for i in range(t):
	solve()


for tc in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = []
	zeros = arr.count(0)
	ones = arr.count(1)
	if ones <= n // 2:
		print(zeros)
		print(*[0] * zeros)
	elif ones % 2 == 0:
		print(ones)
		print(*[1] * ones)
	else:
		print(ones - 1)
		print(*[1] * (ones - 1))


for _ in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	(z, o) = (0, 0)
	if 0 in A:
		z = A.count(0)
	if 1 in A:
		o = A.count(1)
	if o % 2:
		o -= 1
	print(max(z, o))
	if z >= o:
		for i in range(z):
			print(0, end=' ')
	else:
		for i in range(o):
			print(1, end=' ')
	print()


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))[:n]
	ones = 0
	zeros = 0
	for j in a:
		if j == 1:
			ones += 1
		else:
			zeros += 1
	if zeros >= n / 2:
		print(zeros)
		z = [0 for k in range(zeros)]
		print(*z, sep=' ')
	else:
		o = [1 for h in range(ones)]
		if ones % 2 == 0:
			print(ones)
			print(*o, sep=' ')
		else:
			o.remove(1)
			print(len(o))
			print(*o, sep=' ')


import math
for i in range(0, int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	count_zero = 0
	count_one = 0
	for j in a:
		if j == 0:
			count_zero += 1
		else:
			count_one += 1
	if count_zero >= count_one:
		print(count_zero)
		for k in range(0, len(a)):
			if a[k] == 0:
				print(a[k], end=' ')
	else:
		flag = 0
		if count_one % 2:
			flag = 1
			count_one -= 1
		print(count_one)
		for k in range(0, len(a)):
			if a[k] == 1:
				if flag == 1:
					flag = 0
					continue
				print(a[k], end=' ')
	print()


from sys import stdin, stdout

class SOLVE:

	def solve(self):
		R = stdin.readline
		W = stdout.write
		ans = []
		for i in range(int(input())):
			n = int(R())
			a = R()
			zero = a.count('0')
			one = a.count('1')
			one -= one % 2
			if zero >= n // 2:
				ans += [str(zero), '\n', '0 ' * zero, '\n']
			else:
				ans += [str(one), '\n', '1 ' * one, '\n']
		W(''.join(ans))

def main():
	s = SOLVE()
	s.solve()
main()


otv = []
for i in range(int(input())):
	n = int(input())
	l1 = 0
	l0 = 0
	for j in input().split():
		if j == '1':
			l1 += 1
		else:
			l0 += 1
	line = ''
	if l1 > l0:
		if l1 & 1 == 1:
			for j in range(l1 - 1):
				line += '1 '
		else:
			for j in range(l1):
				line += '1 '
	elif l0 > l1:
		if l1 & 1 == 1:
			for j in range(l0 - 1):
				line += '0 '
		else:
			for j in range(l0):
				line += '0 '
	else:
		for j in range(l0):
			line += '0 '
	otv.append(line)
for i in otv:
	print(len(i) // 2)
	print(i)


def haha(arr):
	n = len(arr) // 2
	if arr.count(1) <= n:
		blanck = [0] * arr.count(0)
	if arr.count(0) < n:
		c = 0
		if arr.count(1) % 2 != 0:
			c = 1
		blanck = [1] * (arr.count(1) - c)
	print(len(blanck))
	print(*blanck)
	return ''
t = int(input())
for i in range(t):
	a = input()
	lst = list(map(int, input().strip().split()))
	print(haha(lst))


for vishal in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if a.count(1) > a.count(0):
		kk = n - a.count(0) - (n - a.count(0)) % 2
		print(kk)
		print(' '.join(['1'] * kk))
	else:
		print(n - a.count(1))
		print(' '.join(['0'] * (n - a.count(1))))


for _ in range(int(input())):
	a = int(input())
	b = [int(x) for x in input().split()]
	(m, n) = (b.count(0), b.count(1))
	if m >= n:
		while 1 in b:
			b.remove(1)
		print(len(b))
		print(*b)
	else:
		if n % 2 == 0:
			while 0 in b:
				b.remove(0)
		else:
			while 0 in b:
				b.remove(0)
			b.remove(1)
		print(len(b))
		print(*b)


import sys
import math
fast_reader = sys.stdin.readline
fast_writer = sys.stdout.write

def input():
	return fast_reader().strip()
for T in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ones = sum(a)
	z = n - ones
	if z < n // 2:
		k = n - z
		if k % 2 != 0:
			k -= 1
		print(k)
		for i in range(k):
			print(1, end=' ')
	else:
		print(n - ones)
		for i in range(n - ones):
			print(0, end=' ')
	print()


def ans_f(a):
	if a.count(0) < a.count(1):
		k = a.count(0)
		for j in range(k):
			a.remove(0)
		if a.count(1) % 2 != 0:
			a.remove(1)
	else:
		k = a.count(1)
		for i in range(k):
			a.remove(1)
	return a
t = int(input())
ans = []
for i in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	ans.append(ans_f(a))
for i in ans:
	print(len(i))
	print(*i)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = [int(i) for i in input().split()]
	o = 0
	z = 0
	for i in range(n):
		if a[i] == 1:
			o += 1
		else:
			z += 1
	if n // 2 % 2 == 0:
		if o <= n // 2:
			print(n - o)
			while 1 in a:
				a.remove(1)
			print(*a)
		elif o % 2 == 0:
			print(o)
			while 0 in a:
				a.remove(0)
			print(*a)
		else:
			print(o - 1)
			while 0 in a:
				a.remove(0)
			a.pop()
			print(*a)
	elif o > z:
		while 0 in a:
			a.remove(0)
		if o % 2 == 1:
			a.pop()
			print(o - 1)
		else:
			print(o)
		print(*a)
	else:
		print(z)
		while 1 in a:
			a.remove(1)
		print(*a)


import sys, math, cmath, time
start_time = time.time()

def solve():
	n = inp()
	a = inlt()
	if a.count(1) > a.count(0):
		if a.count(1) % 2 != 0:
			print(a.count(1) - 1)
			print(*[1] * (a.count(1) - 1))
		else:
			print(a.count(1))
			print(*[1] * a.count(1))
	else:
		print(a.count(0))
		print(*[0] * a.count(0))

def main():
	global tt
	if not ONLINE_JUDGE:
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	t = 1
	t = inp()
	for tt in range(t):
		solve()
	if not ONLINE_JUDGE:
		print('Time Elapsed :', time.time() - start_time, 'seconds')
		sys.stdout.close()

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	return input().strip()

def invr():
	return map(int, input().split())

def counter(a):
	q = [0] * max(a)
	for i in range(len(a)):
		q[a[i] - 1] = q[a[i] - 1] + 1
	return q

def counter_elements(a):
	q = dict()
	for i in range(len(a)):
		if a[i] not in q:
			q[a[i]] = 0
		q[a[i]] = q[a[i]] + 1
	return q

def string_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
	return q

def factors(n):
	q = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			q.append(i)
			q.append(n // i)
	return list(sorted(list(set(q))))

def prime_factors(n):
	q = []
	while n % 2 == 0:
		q.append(2)
		n = n // 2
	for i in range(3, int(n ** 0.5) + 1, 2):
		while n % i == 0:
			q.append(i)
			n = n // i
	if n > 2:
		q.append(n)
	return list(sorted(q))

def transpose(a):
	(n, m) = (len(a), len(a[0]))
	b = [[0] * n for i in range(m)]
	for i in range(m):
		for j in range(n):
			b[i][j] = a[j][i]
	return b

def factorial(n, m=1000000007):
	q = 1
	for i in range(n):
		q = q * (i + 1) % m
	return q
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
	input = sys.stdin.readline
main()


def solver(a):
	if sum(a) <= len(a) / 2:
		m = list(filter(lambda x: x == 0, a))
		n = len(m)
	else:
		m = list(filter(lambda x: x == 1, a))
		if len(m) == 1 or len(m) % 2 != 0:
			m = m[:-1]
		n = len(m)
	result = str(n) + '\n' + ' '.join([str(x) for x in m])
	return result
nstr = int(input())
for i in range(nstr):
	N = int(input())
	M = [int(x) for x in input().split()]
	print(solver(M))


t = int(input())

def solve():
	n = int(input())
	a = [int(i) for i in input().split()]
	one = 0
	zero = 0
	for i in range(n):
		if a[i] == 1:
			one += 1
		else:
			zero += 1
	if one <= zero:
		print(zero)
		ans = [0 for i in range(zero)]
		print(*ans, sep=' ')
	else:
		if one % 2:
			one -= 1
		print(one)
		ans = [1 for i in range(one)]
		print(*ans, sep=' ')
while t:
	t -= 1
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	s1 = 0
	s2 = 0
	for i in range(n):
		if a[i]:
			s1 += 1
		else:
			s2 += 1
	ans = []
	if s1 <= s2:
		ans = [0] * s2
	else:
		ans = [1] * (s1 - s1 % 2)
	print(len(ans))
	if len(ans):
		print(*ans)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	o = 0
	z = 0
	for i in range(n):
		if l[i]:
			o += 1
		else:
			z += 1
	if o > z:
		o -= o % 2
		print(o)
		for i in range(o):
			print(1, end=' ')
	else:
		print(z)
		for i in range(z):
			print(0, end=' ')
	print()


t = int(input())
while t > 0:
	n = int(input())
	a = [int(x) for x in input().split()]
	c = a.count(0)
	c1 = a.count(1)
	if c >= n / 2:
		print(c)
		for i in range(c):
			print(0, end=' ')
		print()
	else:
		if c1 & 1:
			c1 -= 1
		print(c1)
		for i in range(c1):
			print(1, end=' ')
		print()
	t = t - 1


x = int(input())
ansl = []
for i in range(x):
	y = int(input())
	z = list(map(int, input().split()))
	if z.count(0) < len(z) / 2:
		while z.count(0) > 0:
			z.remove(0)
		if len(z) % 2 == 1 and sum(z) > 0:
			z.remove(1)
	else:
		while z.count(1) > 0:
			z.remove(1)
	rl = [len(z)]
	ansl.append(rl)
	ansl.append(z)
for i in ansl:
	print(*i)


import sys
import math
import collections
import operator as op
from collections import deque
from math import gcd, inf, sqrt, pi, cos, sin, ceil, log2
from bisect import bisect_right, bisect_left
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def factorial(n):
	if n == 0:
		return 1
	return n * factorial(n - 1)

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return list(factors)

def sumDigits(no):
	return 0 if no == 0 else int(no % 10) + sumDigits(int(no / 10))
MOD = 1000000007
PMOD = 998244353
N = 10 ** 5
T = 1
T = int(stdin.readline())
for _ in range(T):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().rstrip().split()))
	oc = a.count(1)
	zc = a.count(0)
	if oc == zc:
		print(n // 2)
		print(*[0] * zc)
	elif oc > zc:
		if oc % 2 == 1:
			print(oc - 1)
			print(*[1] * (oc - 1))
		else:
			print(oc)
			print(*[1] * oc)
	else:
		print(zc)
		print(*[0] * zc)


test_cases = int(input())
for _ in range(test_cases):
	n = int(input())
	a = [int(i) for i in input().split(' ')]
	ones = a.count(1)
	zeroes = a.count(0)
	if zeroes >= ones:
		print(zeroes)
		print('0 ' * zeroes)
	else:
		if ones % 2 != 0:
			ones -= 1
		print(ones)
		print('1 ' * ones)


for i in range(int(input())):
	n = int(input())
	arr = list(input().split())
	arr.sort(reverse=True)
	if '0' in arr:
		idx = arr.index('0')
		if arr.count('0') >= arr.count('1'):
			arr = arr[idx:]
		else:
			arr = arr[:idx]
			if len(arr) % 2 != 0:
				arr.pop()
	elif len(arr) % 2 != 0:
		arr.pop()
	print(len(arr))
	print(*arr)


for _ in range(int(input())):
	size = int(input())
	l = list(map(int, input().split()))
	zeros = l.count(0)
	if zeros >= size // 2:
		ans = '0' * zeros
	else:
		ones = l.count(1)
		ones //= 2
		ones *= 2
		ans = '1' * ones
	print(len(ans))
	ans = list(ans)
	ans = ' '.join(ans)
	print(ans)


T = int(input())
for t in range(T):
	n = int(input())
	A = [int(i) for i in input().split()]
	one_count = 0
	for i in A:
		if i == 1:
			one_count += 1
	if one_count <= n // 2:
		ans = [0] * (n - one_count)
	elif one_count % 2:
		ans = [1] * (one_count - 1)
	else:
		ans = [1] * one_count
	print(len(ans))
	print(*ans)


import sys
import os.path
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
	sys.stdout = open('out.txt', 'w')
for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	s = ''.join(map(str, li))
	if n - li.count(1) >= n // 2:
		ans = '0' * (n - li.count(1))
	else:
		ans = '1' * li.count(1)
		if len(ans) % 2:
			ans = ans[:len(ans) - 1]
	print(len(ans))
	print(' '.join(ans))


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	z = o = 0
	for i in a:
		if i == 1:
			o += 1
		else:
			z += 1
	if z >= o:
		print(z)
		ans = [0] * z
		print(*ans)
	else:
		if o % 2 != 0:
			o -= 1
		ans = []
		for i in range(o):
			ans.append(1)
		print(len(ans))
		print(*ans)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ca = a.count(1)
	cb = n - ca
	if cb >= (n + 1) // 2:
		print(cb)
		print('0 ' * cb)
	elif ca % 2 == 0:
		print(ca)
		print('1 ' * ca)
	else:
		print(ca - 1)
		print('1 ' * (ca - 1))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ones = 0
	zeros = 0
	for i in range(n):
		if a[i] == 0:
			zeros += 1
		else:
			ones += 1
	if ones > n // 2:
		if ones % 2 == 1:
			ones -= 1
		print(ones)
		for i in range(ones):
			print(1, end=' ')
		print()
	else:
		print(zeros)
		for i in range(zeros):
			print(0, end=' ')
		print()


from math import log2, ceil

def readGenerator():
	while True:
		tokens = input().split(' ')
		for t in tokens:
			yield t
reader = readGenerator()

def readWord():
	return next(reader)

def readInt():
	return int(next(reader))

def readFloat():
	return float(next(reader))

def readLine():
	return input()

def solve(a):
	(v0, v1) = (0, 0)
	for i in a:
		if i == 0:
			v0 += 1
		else:
			v1 += 1
	if v1 > v0:
		if v1 % 2 != 0:
			v1 -= 1
		print(v1)
		return '1 ' * v1
	print(v0)
	return '0 ' * v0
tests = readInt()
for i in range(tests):
	n = readInt()
	a = [readInt() for _ in range(n)]
	print(solve(a))


def ans(a, n):
	ones = 0
	zeroes = 0
	for i in a:
		if i == 0:
			zeroes += 1
		else:
			ones += 1
	if zeroes > ones:
		print(zeroes)
		s = '0 ' * zeroes
		print(s)
	elif zeroes < ones:
		if ones % 2 == 0:
			print(ones)
			s = '1 ' * ones
			print(s)
		else:
			print(ones - 1)
			s = '1 ' * (ones - 1)
			print(s)
	else:
		print(zeroes)
		s = '0 ' * zeroes
		print(s)
	return
m = int(input())
for i in range(m):
	n = int(input())
	arr = input().split()
	a = []
	for i in arr:
		a.append(int(i))
	ans(a, n)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	o = l.count(1)
	z = l.count(0)
	ans = []
	if o <= n // 2:
		ans = [0] * z
	else:
		ans = [1] * o
	if len(ans) % 2 != 0 and ans[0] == 1:
		ans.pop()
	print(len(ans))
	print(*ans)


for i in range(int(input())):
	a = int(input())
	l = list(map(int, input().split()))
	m = l.count(1)
	if m > int(a / 2):
		i = 0
		while i < len(l):
			if not l[i]:
				l.pop(i)
				i -= 1
			i += 1
		if m % 2 == 1:
			l.remove(1)
	else:
		i = 0
		while i < len(l):
			if l[i]:
				l.pop(i)
				i -= 1
			i += 1
	print(len(l))
	for i in range(len(l) - 1):
		print(l[i], end=' ')
	print(l[len(l) - 1])


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	c1 = a.count(1)
	c0 = a.count(0)
	if n == 2:
		if c1 == 1:
			print(1)
			return [0]
		if c1 == 0:
			print(2)
			return [0, 0]
		if c1 == 2:
			print(2)
			return [1, 1]
	if c1 == c0:
		print(c1)
		return [0] * c1
	elif c1 > c0:
		if c1 % 2 == 0:
			print(c1)
			return [1] * c1
		else:
			print(c1 - 1)
			return [1] * (c1 - 1)
	elif c0 % 2 == 0:
		print(c0)
		return [0] * c0
	else:
		print(c0 - 1)
		return [0] * (c0 - 1)
T = int(input())
for i in range(T):
	a = solve()
	n = len(a)
	for i in range(n):
		if i == n - 1:
			print(a[i])
		else:
			print(a[i], end=' ')


from collections import Counter, deque
import math
from random import randint
from bisect import bisect
import sys
import re
import copy
MOD = 1000000007
MAX = sys.maxsize
MIN = -sys.maxsize

class get:

	def int():
		return list(map(int, input().split()))

	def str():
		return input().split()

	def float():
		return list(map(float, input().split()))

	def map():
		return map(int, input().split())

def sqrt(x):
	return int(math.sqrt(x)) + 1

def gcd(*args):
	result = args[0]
	for item in args:
		result = math.gcd(result, item)
	return result

def LCM(a, b):
	return a * b // math.gcd(a, b)

def solve():
	n = int(input())
	arr = get.int()
	c_0 = arr.count(0)
	c_1 = arr.count(1)
	if c_0 > c_1:
		res = [0] * (c_0 // 2 * 2)
		print(len(res))
		print(*res)
	elif c_1 > c_0:
		res = [1] * (c_1 // 2 * 2)
		print(len(res))
		print(*res)
	else:
		print(n // 2)
		res = [0] * (n // 2)
		print(*res)
for _ in range(int(input())):
	solve()


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	cnt0 = a.count(0)
	if cnt0 >= n // 2:
		a = [i for i in a if i == 0]
	else:
		a = [i for i in a if i == 1]
		if len(a) % 2 == 1:
			a.pop()
	print(len(a))
	print(*a)


t = int(input())
for tests in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	zeros_count = a.count(0)
	ones_count = n - zeros_count
	if ones_count % 2 != 0 and n > 2:
		a.remove(1)
		ones_count -= 1
	if zeros_count >= ones_count:
		k = zeros_count
		output = [0] * k
	else:
		k = ones_count
		output = [1] * k
	print(k)
	print(*output)


import os
import sys
from io import BytesIO, IOBase
import math
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	z = 0
	o = 0
	for i in range(n):
		if l[i] == 1:
			o += 1
		else:
			z += 1
	if o <= n // 2:
		print(z)
		for i in range(z):
			print(0, end=' ')
		print()
	else:
		print(n // 2 + n // 2 % 2)
		for i in range(n // 2 + n // 2 % 2):
			print(1, end=' ')
		print()


for _ in range(int(input())):
	n = int(input())
	A = [int(i) for i in input().split()]
	(ones, zeroes) = (A.count(1), A.count(0))
	if ones > zeroes:
		final = '1' * ones
		if len(final) % 2:
			ones -= 1
			final = '1' * ones
		print(ones)
	else:
		final = '0' * zeroes
		print(zeroes)
	print(' '.join(final))


from collections import deque
import copy
for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	z = l.count(0)
	o = l.count(1)
	if z >= n // 2:
		print(z)
		print('0 ' * z)
	elif o >= n // 2:
		print(o // 2 * 2)
		print('1 ' * (o // 2 * 2))


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	one = 0
	zero = 0
	for i in range(n):
		if arr[i] == 0:
			zero += 1
		else:
			one += 1
	if zero == 0 or one == 0:
		print(n)
		print(*arr)
	elif zero > one:
		ar = [0] * (zero // 2 * 2)
		print(len(ar))
		print(*ar)
	elif one > zero:
		ar = [1] * (one // 2 * 2)
		print(len(ar))
		print(*ar)
	elif zero % 2 == 0:
		ar = [0] * zero
		print(zero)
		print(*ar)
	elif zero == 1:
		print(1)
		print(0)
	else:
		ar = []
		x = 0
		while x < n - 2:
			if arr[x] == arr[x + 1]:
				ar.append(arr[x])
				ar.append(arr[x + 1])
				x += 2
			elif arr[x] == arr[x + 2]:
				ar.append(arr[x])
				ar.append(arr[x + 2])
				x += 3
			else:
				ar.append(arr[x + 1])
				ar.append(arr[x + 2])
				x += 3
		print(len(ar))
		print(*ar)


import math

def dtb(n):
	return bin(n).replace('0b', '')

def btd(n):
	return int(n, 2)
t = int(input())
for k in range(t):
	n = int(input())
	a = list(map(int, input().split()))[:n]
	(zero, one) = (0, 0)
	if n % 4 == 0:
		for i in range(n):
			if a[i] == 0:
				zero += 1
			else:
				one += 1
		print(n // 2)
		if zero >= n // 2:
			for i in range(n // 2):
				print(0, end=' ')
		elif one >= n // 2:
			for i in range(n // 2):
				print(1, end=' ')
	else:
		for i in range(n):
			if a[i] == 0:
				zero += 1
			else:
				one += 1
		if one >= n // 2 + 1:
			print(n // 2 + 1)
			for i in range(n // 2 + 1):
				print(1, end=' ')
		elif zero >= n // 2 + 1:
			print(n // 2 + 1)
			for i in range(n // 2 + 1):
				print(0, end=' ')
		elif one == zero:
			print(n // 2)
			for i in range(n // 2):
				print(0, end=' ')
	print()


t = int(input())
for i in range(t):
	n = int(input())
	q = 0
	a = [int(i) for i in input().split()]
	for i in range(len(a)):
		if a[i] == 0:
			q += 1
	q1 = n - q
	if q >= n / 2:
		print(q)
		for i in range(q):
			print(0)
	else:
		print(q1 - q1 % 2)
		for i in range(q1 - q1 % 2):
			print(1)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for j in range(int(input())):
	n = int(input())
	vals = list(map(int, input().split()))
	zer = 0
	one = 0
	for s in range(n):
		if vals[s] == 0:
			zer += 1
		else:
			one += 1
	if zer == 0:
		print(n)
		print(*vals)
	elif one == 0:
		print(n)
		print(*vals)
	elif zer == one:
		print(n - one)
		print(*[0 for s in range(n - one)])
	elif zer < one:
		if zer % 2 == 0:
			print(n - zer)
			print(*[1 for s in range(n - zer)])
		else:
			print(n - (zer + 1))
			ans = [1 for s in range(n - (zer + 1))]
			print(*ans)
	else:
		print(n - one)
		print(*[0 for s in range(n - one)])


import itertools
import math
import sys
from collections import defaultdict

def stdinWrapper():
	data = '4\n2\n1 0\n2\n0 0\n4\n0 1 1 1\n4\n1 1 0 0\n'
	for line in data.split('\n'):
		yield line
if '--debug' not in sys.argv:

	def stdinWrapper():
		while True:
			yield input()
inputs = stdinWrapper()

def inputWrapper():
	return next(inputs)

def getType(_type):
	return _type(inputWrapper())

def getArray(_type):
	return [_type(x) for x in inputWrapper().split()]

def solve(a):
	zeroes = len([x for x in a if x == 0])
	ones = len([x for x in a if x == 1])
	if zeroes >= len(a) / 2:
		return [0] * zeroes
	if ones % 2:
		ones -= 1
	return [1] * ones
t = getType(int)
for _ in range(t):
	n = getType(int)
	a = getArray(int)
	arr = solve(a)
	print(len(arr))
	print(' '.join(list(map(str, arr))))


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	no_zeros = 0
	for i in range(n):
		if a[i] == 0:
			no_zeros += 1
	if no_zeros >= n / 2:
		print(no_zeros)
		for i in range(no_zeros):
			print(0, end=' ')
	else:
		x = n - no_zeros
		z = x if x % 2 == 0 else x - 1
		print(z)
		for i in range(z):
			print(1, end=' ')
	print()


for q in range(int(input())):
	n = int(input())
	a = input().split()
	one = a.count('1')
	z = n - one
	if one <= n // 2:
		print(z)
		print('0 ' * z)
	elif one % 2 == 0:
		print(one)
		print('1 ' * one)
	else:
		print(one - 1)
		print('1 ' * (one - 1))


import math
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	no = a.count(1)
	if no == n or no == 0:
		print(n)
		print(*a)
	elif no <= n // 2:
		print(n - no)
		print('0 ' * (n - no))
	elif no % 2 == 0:
		print(no)
		print('1 ' * no)
	else:
		no -= 1
		print(no)
		print('1 ' * no)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	k = sum(a)
	s = []
	if k > n - k:
		for i in a:
			if i == 1:
				s.append(i)
		if len(s) % 2 != 0:
			s.remove(1)
	else:
		for i in a:
			if i == 0:
				s.append(i)
	print(len(s))
	print(*s, sep=' ')


from math import gcd, ceil, log
from collections import Counter, deque

def rl():
	return list(map(int, input().split()))

def arp(arr):
	return ' '.join([str(i) for i in arr])
for _ in range(int(input())):
	(n,) = rl()
	arr = rl()
	(o, z) = (0, 0)
	for i in arr:
		if i == 1:
			o += 1
		else:
			z += 1
	if n == 2 and arr[0] == 1 and (arr[1] == 1):
		print(n)
		print(arp(arr))
	else:
		anss = []
		zzzz = []
		if o <= n // 2:
			for i in range(z):
				zzzz.append(0)
			print(n - o)
			print(arp(zzzz))
		else:
			if o & 1:
				o -= 1
			for i in range(o):
				anss.append(1)
			print(len(anss))
			print(arp(anss))


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	c_1 = arr.count(1)
	c_0 = arr.count(0)
	if c_0 >= n // 2:
		print(c_0)
		print(' '.join(('0' for i in range(c_0))))
	else:
		if c_1 % 2 != 0:
			c_1 -= 1
		print(c_1)
		print(' '.join(('1' for i in range(c_1))))


import io
import os
from collections import Counter, defaultdict, deque

def solve(N, A):
	zeroes = A.count(0)
	ones = A.count(1)
	assert zeroes + ones == N
	if zeroes >= N // 2:
		A = [0] * zeroes
	else:
		A = [1] * (2 * (ones // 2))
	return str(len(A)) + '\n' + ' '.join(map(str, A))
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
TC = int(input())
for tc in range(1, TC + 1):
	(N,) = [int(x) for x in input().split()]
	A = [int(x) for x in input().split()]
	ans = solve(N, A)
	print(ans)


import sys

def answer(n, a):
	if a.count(1) <= n // 2:
		print(n - a.count(1))
		print('0 ' * a.count(0))
		return
	if a.count(1) % 2 == 0:
		print(a.count(1))
		print('1 ' * a.count(1))
		return
	print(a.count(1) - 1)
	print('1 ' * (a.count(1) - 1))
	return

def main():
	t = int(input())
	while t:
		n = int(input())
		a = [int(i) for i in sys.stdin.readline().split()]
		answer(n, a)
		t -= 1
	return
main()


from sys import stdin
import math
inp = lambda : stdin.readline().strip()
t = int(inp())
for _ in range(t):
	n = int(inp())
	a = [int(x) for x in inp().split()]
	if a.count(1) <= a.count(0):
		a2 = [int(x) for x in a if x == 0]
		print(len(a2))
		print(*a2)
	else:
		a2 = [int(x) for x in a if x == 1]
		if len(a2) % 2 == 1:
			a2.pop()
		print(len(a2))
		print(*a2)


t = int(input())
while t > 0:
	n = int(input())
	li = list(map(int, input().split()))
	s = sum(li)
	if s == n or s == 0:
		print(n)
		for item in li:
			print(item, end=' ')
			pass
		print()
	elif s <= n / 2:
		print(n - s)
		i = 0
		while i < s:
			li.remove(1)
			i += 1
			pass
		for item in li:
			print(item, end=' ')
			pass
		print()
	elif s > n / 2:
		i = 0
		while i < n - s:
			li.remove(0)
			i += 1
			pass
		if s % 2 == 0:
			print(s)
			for item in li:
				print(item, end=' ')
			print()
		else:
			del li[0]
			print(s - 1)
			for item in li:
				print(item, end=' ')
			print()
		pass
	t -= 1
	pass


import sys
import os
import math
import copy
from math import gcd
from bisect import bisect
from io import BytesIO, IOBase
from math import sqrt, floor, factorial, gcd, log, ceil
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations
from itertools import accumulate

def Int():
	return int(sys.stdin.readline())

def Mint():
	return map(int, sys.stdin.readline().split())

def Lstr():
	return list(sys.stdin.readline().strip())

def Str():
	return sys.stdin.readline().strip()

def Mstr():
	return map(str, sys.stdin.readline().strip().split())

def List():
	return list(map(int, sys.stdin.readline().split()))

def Hash():
	return dict()

def Mod():
	return 1000000007

def Ncr(n, r, p):
	return fact[n] * (ifact[r] * ifact[n - r] % p) % p

def Most_frequent(list):
	return max(set(list), key=list.count)

def Mat2x2(n):
	return [List() for _ in range(n)]

def Lcm(x, y):
	return x * y // gcd(x, y)

def dtob(n):
	return bin(n).replace('0b', '')

def btod(n):
	return int(n, 2)

def common(l1, l2):
	return set(l1).intersection(l2)

def solution():
	for _ in range(Int()):
		n = Int()
		a = List()
		o = a.count(1)
		z = a.count(0)
		if z >= o:
			ans = '0' * z
		else:
			ans = '1' * (o - o % 2)
		print(len(ans))
		print(' '.join(ans))
solution()


for _ in range(int(input())):
	n = int(input())
	A = [int(_) for _ in input().split()]
	(zrs, one) = (0, 0)
	for _ in range(n):
		if A[_] == 1:
			one += 1
		else:
			zrs += 1
	if zrs >= one or one == 1:
		print(zrs)
		for _ in range(zrs):
			print(0, end=' ')
		print()
	else:
		if one % 2 == 1:
			one -= 1
		print(one)
		for _ in range(one):
			print(1, end=' ')
		print()


import math
from decimal import *
import random
for _ in range(int(input())):
	n = int(input())
	arr = list(map(str, input().split()))
	(ones, zeroes) = (0, 0)
	for i in range(n):
		if arr[i] == '1':
			ones += 1
		else:
			zeroes += 1
	if zeroes >= n // 2:
		print(zeroes)
		print('0 ' * zeroes)
	else:
		print(ones // 2 * 2)
		print('1 ' * (ones // 2 * 2))


t = int(input())
for _ in range(t):
	n = int(input())
	a = input().split()
	ct0 = 0
	ct1 = 0
	for c in a:
		if c == '0':
			ct0 += 1
		else:
			ct1 += 1
	if ct0 >= ct1:
		key = '0'
		ct = ct0
	else:
		key = '1'
		ct = ct1
		ct = ct - ct % 2
	output = [key] * ct
	output = ' '.join(output)
	print(ct)
	print(output)


import io
import os
import sys
import math
fileno = sys.stdin.fileno()
input = io.BytesIO(os.read(fileno, os.fstat(fileno).st_size)).readline
T = int(input())
for i in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	ones = sum(A)
	if ones <= N // 2:
		k = N - ones
		print(k)
		print(' '.join(('0' for i in range(k))))
	else:
		k = ones - ones % 2
		print(k)
		print(' '.join(('1' for i in range(k))))


testcases = int(input())
for _ in range(testcases):
	n = int(input())
	l = list(map(int, input().split()))
	cnt0 = l.count(0)
	cnt1 = n - cnt0
	if cnt0 >= n // 2:
		print(cnt0)
		for i in range(cnt0 - 1):
			print(0, end=' ')
		else:
			print(0)
	else:
		print(cnt1 - cnt1 % 2)
		for i in range(cnt1 - cnt1 % 2 - 1):
			print(1, end=' ')
		else:
			print(1)


for _ in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	czero = lst.count(0)
	cone = lst.count(1)
	if cone <= n // 2:
		ans = [0 for i in range(n - cone)]
	else:
		ans = [1 for i in range(n - czero)]
		if czero % 2 != 0:
			ans.remove(1)
	print(len(ans))
	print(*ans)


def mapit():
	temp = list(map(int, input().split()))
	return temp

def solution():
	n = int(input())
	arr = mapit()
	sm = sum(arr)
	if sm <= n // 2:
		print(n - sm)
		ans = [0] * (n - sm)
		print(*ans)
	else:
		if sm % 2:
			sm -= 1
		ans = [1] * sm
		print(sm)
		print(*ans)
	return
t = int(input())
while t:
	t -= 1
	solution()


for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	count0 = ar.count(0)
	count1 = ar.count(1)
	if count0 >= count1:
		print(count0)
		print('0 ' * count0)
	else:
		print(count1 // 2 * 2)
		print('1 ' * (count1 // 2) * 2)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	o = a.count(1)
	z = a.count(0)
	if o > z:
		if o % 2 == 0:
			print(o)
			for i in range(o):
				print(1, end=' ')
		else:
			print(o - 1)
			for i in range(o - 1):
				print(1, end=' ')
	elif z % 2 == 0 or z % 2 == 1:
		print(z)
		for i in range(z):
			print(0, end=' ')
	print()


from os import path
import sys
from heapq import heappush, heappop
from functools import cmp_to_key as ctk
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input().rstrip()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def bo(i):
	return ord(i) - ord('a')
file = 1

def f():
	sys.stdout.flush()

def solve():
	for _ in range(ii()):
		n = ii()
		a = li()
		cnt0 = a.count(0)
		cnt1 = a.count(1)
		if cnt0 >= cnt1:
			print(cnt0)
			print('0 ' * cnt0)
		else:
			if cnt1 & 1:
				cnt1 -= 1
			print(cnt1)
			print('1 ' * cnt1)
if file:
	if path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	else:
		input = sys.stdin.readline
solve()


testcases = int(input())
for _ in range(testcases):
	n = int(input())
	arr = list(map(int, input().split()))
	o = 0
	z = 0
	for i in arr:
		if i == 0:
			z += 1
		else:
			o += 1
	if z >= o:
		print(z)
		answer = '0 ' * z
	elif o % 2 == 0:
		print(o)
		answer = '1 ' * o
	else:
		print(o - 1)
		answer = '1 ' * (o - 1)
	print(answer[:-1])


TC = int(input())
for _ in range(TC):
	n = int(input())
	a = list(map(int, input().split()))
	cnt = [0, 0]
	for x in a:
		cnt[x] += 1
	if cnt[0] >= cnt[1]:
		print(cnt[0])
		print('0 ' * cnt[0])
	else:
		print(cnt[1] - cnt[1] % 2)
		print('1 ' * (cnt[1] - cnt[1] % 2))


from collections import Counter
for _ in range(int(input())):
	i_liczb = int(input())
	liczby = list(map(int, input().split()))
	conter = Counter(liczby)
	(ile_0, ile_1) = (conter[0], conter[1])
	if ile_0 >= i_liczb // 2:
		print(ile_0)
		print('0 ' * ile_0)
	else:
		print(ile_1 - ile_1 % 2)
		print('1 ' * (ile_1 - ile_1 % 2))


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	el = [0, 0]
	for i in a:
		el[i] += 1
	if el[0] == el[1]:
		print(n // 2)
		print(*[0 for _ in range(n // 2)])
	else:
		ts = n // 2 + n // 2 % 2
		print(ts)
		print(*[int(el[1] > el[0]) for _ in range(ts)])


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	zero = 0
	one = 0
	for i in a:
		if i == 1:
			one += 1
		else:
			zero += 1
	if zero >= one:
		print(zero)
		ans = [0] * zero
		print(*ans)
	elif one % 2 == 0:
		ans = [1] * one
		print(one)
		print(*ans)
	else:
		one -= 1
		ans = [1] * one
		print(one)
		print(*ans)


import os, sys
from io import BytesIO, IOBase
from collections import defaultdict

def main():
	from math import gcd
	for _ in range(int(input())):
		n = int(input())
		mn = 0
		a = [int(X) for X in input().split()]
		x = a.count(1)
		y = n - x
		if x > y:
			if x % 2 == 1:
				print(n - y - 1)
				print(*[1] * (x - 1))
			else:
				print(n - y)
				print(*[1] * x)
		else:
			print(y)
			print(*[0] * y)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from collections import defaultdict
import sys
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	cnt = [0, 0]
	for x in a:
		cnt[x] += 1
	if cnt[0] >= n // 2:
		print(cnt[0])
		print('0 ' * cnt[0])
	else:
		print(cnt[1] - cnt[1] % 2)
		print('1 ' * (cnt[1] - cnt[1] % 2))


case = int(input())
for i in range(case):
	input()
	lst = list(map(int, input().split(' ')))
	one = lst.count(1)
	zero = lst.count(0)
	f = 0
	if one <= zero:
		f = 1
	else:
		f = 0
	for x in range(min(one, zero)):
		lst.remove(f)
	if 0 not in lst and len(lst) % 2 == 1:
		lst.remove(1)
	print(len(lst))
	print(*lst)


import sys
input = sys.stdin.readline

def f():
	n = int(input())
	A = list(map(int, input().split()))
	c = sum(A)
	if c <= n // 2:
		print(n - c)
		print(*[0] * (n - c))
	else:
		print(c - c % 2)
		print(*[1] * (c - c % 2))
t = int(input())
for x in range(t):
	f()


def listt(n, a):
	c0 = a.count(0)
	c1 = a.count(1)
	if c1 <= n:
		a = [0] * c0
	elif c0 < n:
		a = [1] * c1
		if len(a) % 2 == 1:
			a.remove(1)
	return a
t = int(input())
for i in range(t):
	n = int(input())
	j = [int(i) for i in input().split()]
	l = listt(n // 2, j)
	print(len(l))
	print(' '.join([str(i) for i in l]))


n = int(input())
for _ in range(n):
	s = int(input())
	mas = list(map(int, input().split()))
	summas = sum(mas)
	if summas <= s / 2:
		print(s - summas)
		print(*[0 for _ in range(s - summas)])
	else:
		count = summas - summas % 2
		print(count)
		print(*[1 for _ in range(count)])


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	a = l.count(0)
	b = l.count(1)
	n = n // 2
	if b <= n:
		print(a)
		for i in range(a):
			print(0, end=' ')
	else:
		if b % 2 == 1:
			b -= 1
		print(b)
		for i in range(b):
			print(1, end=' ')
	print()


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = [int(_) for _ in input().split(' ')]
	ans = []
	zeroes = 0
	ones = 0
	for i in a:
		if i:
			ones += 1
		else:
			zeroes += 1
	if ones > zeroes:
		ans = [1 for _ in range(ones)]
	else:
		ans = [0 for _ in range(zeroes)]
	l = len(ans)
	if l > 1 and l % 2 != 0 and (ans[0] == 1):
		l -= 1
		ans.pop(0)
	print(len(ans))
	print(*ans)


from collections import Counter
for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = Counter(a)
	if b[1] > n // 2:
		ans = []
		for j in range(n):
			if a[j] == 1:
				ans.append(a[j])
		if len(ans) % 2 != 0:
			ans.pop()
		print(len(ans))
		for j in ans:
			print(j, end=' ')
	else:
		ans = []
		for j in range(n):
			if a[j] == 0:
				ans.append(a[j])
		print(len(ans))
		for j in ans:
			print(j, end=' ')
	print('')


ct = input()
for line in range(int(ct)):
	n = input()
	arr = [int(i) for i in input().split()]
	if arr.count(0) >= arr.count(1):
		test = ['0'] * arr.count(0)
		final = ' '.join(test)
		print(arr.count(0))
	else:
		if arr.count(1) % 2 == 1:
			tt = arr.count(1) - 1
		else:
			tt = arr.count(1)
		test = ['1'] * tt
		final = ' '.join(test)
		print(tt)
	print(final)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	p = a.count(1)
	q = a.count(0)
	if p > q:
		ans = []
		for i in range(n):
			if a[i] == 1:
				ans.append(1)
		if len(ans) % 2 != 0:
			print(len(ans[1:]))
			print(*ans[1:])
		else:
			print(len(ans))
			print(*ans)
	elif q >= p:
		ans = []
		for i in range(n):
			if a[i] == 0:
				ans.append(0)
		print(len(ans))
		print(*ans)


import math
t = int(input())
while t > 0:
	n = int(input())
	a = list(map(int, input().split()))
	ones = a.count(1)
	zeroes = a.count(0)
	result = []
	if ones <= n / 2:
		result = [0] * zeroes
	else:
		result = [1] * (int(ones / 2) * 2)
	print(len(result))
	print(' '.join((str(num) for num in result)))
	t -= 1


from math import *
from bisect import *
from collections import Counter, defaultdict, deque
I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))
for _ in range(I()):
	n = I()
	a = LI()
	o = 0
	z = 0
	for i in range(n):
		if a[i] == 1:
			o += 1
		else:
			z += 1
	if max(o, z) == z:
		print(z)
		print('0 ' * z)
	else:
		o -= o % 2
		print(o)
		print('1 ' * o)


from collections import Counter
t = int(input())
while t > 0:
	n = int(input())
	arr = list(map(int, input().split()))
	c = Counter(arr)
	n0 = c[0]
	n1 = c[1]
	if n0 >= n / 2:
		print(n0)
		for i in range(0, n0):
			print('0', end=' ')
		print(end='\n')
	else:
		print(n1 - n1 % 2)
		for i in range(0, n1 - n1 % 2):
			print('1', end=' ')
		print(end='\n')
	t -= 1


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	count1 = a.count(1)
	count0 = a.count(0)
	if count0 >= count1:
		print(count0)
		for i in range(count0):
			print(0, end=' ')
		print()
	else:
		p = n // 2 + n // 2 % 2
		print(p)
		for i in range(p):
			print(1, end=' ')
		print()


t = int(input())
test_cases = []
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	test_cases.append((n, arr))
for case in test_cases:
	(n, arr) = case
	ones = sum(arr)
	if ones <= n // 2:
		remain = n - ones
		result = '0 ' * remain
	else:
		remain = ones - ones % 2
		result = '1 ' * remain
	print(remain)
	print(result)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(n1, n0) = (0, 0)
	for i in a:
		if i == 1:
			n1 += 1
		else:
			n0 += 1
	if n0 >= n1:
		print(n0)
		for i in range(n0):
			print(0, end=' ')
		print()
	elif n1 % 2 == 0:
		print(n1)
		for i in range(n1):
			print(1, end=' ')
		print()
	else:
		n1 = n1 - 1
		print(n1)
		for i in range(n1):
			print(1, end=' ')
		print()


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	count0 = 0
	count1 = 0
	for i in range(n):
		if a[i] == 1:
			count1 += 1
		else:
			count0 += 1
	if count1 <= n // 2:
		res = [0] * (n - count1)
		print(len(res))
		print(*res)
	else:
		if count1 % 2 != 0:
			res = [1] * (n - count0 - 1)
		else:
			res = [1] * (n - count0)
		print(len(res))
		print(*res)


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase

def main():

	def solve():
		n = int(input())
		(count0, count1) = (0, 0)
		for num in input().split():
			if num == '0':
				count0 += 1
			else:
				count1 += 1
		if count1 <= n / 2:
			remainingType = '0'
			remainingNumbers = n - count1
		else:
			remainingType = '1'
			remainingNumbers = n - count0
			if count1 & 1:
				remainingNumbers -= 1
		print(remainingNumbers)
		print(' '.join([remainingType] * remainingNumbers))
	t = int(input())
	for i in range(t):
		solve()
BUFFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
input = lambda : sys.stdin.readline().rstrip('\r\n')

def print(*args, **kwargs):
	sep = kwargs.pop('sep', ' ')
	file = kwargs.pop('file', sys.stdout)
	atStart = True
	for x in args:
		if not atStart:
			file.write(sep)
		file.write(str(x))
		atStart = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
main()


MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from collections import *
for _ in range(ii()):
	n = ii()
	a = il()
	if a.count(0) >= a.count(1):
		l = [0] * a.count(0)
		print(len(l))
		print(*l)
	elif a.count(1) % 2 != 0:
		l = [1] * (a.count(1) - 1)
		print(len(l))
		print(*l)
	else:
		l = [1] * a.count(1)
		print(len(l))
		print(*l)


for i in range(int(input())):
	n = int(input())
	data = sum([int(x) for x in input().split()])
	if data <= n // 2:
		print(n - data)
		print('0 ' * (n - data))
	else:
		print(data // 2 * 2)
		print('1 ' * (data // 2 * 2))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(c0, c1) = (a.count(0), a.count(1))
	ans = []
	if c1 <= n // 2:
		for i in a:
			if i == 0:
				ans.append(i)
	else:
		flag = 1 if c1 & 1 else 0
		for i in a:
			if flag and i == 1:
				flag = 0
				continue
			if i == 1:
				ans.append(i)
	print(len(ans))
	for i in range(len(ans) - 1):
		print(ans[i], end=' ')
	print(ans[-1])


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	(one, zero) = (0, 0)
	for j in range(n):
		if l[j] == 1:
			one += 1
		else:
			zero += 1
	if one <= n // 2:
		print(zero)
		print('0 ' * zero)
	elif one % 2:
		print(one - 1)
		print('1 ' * (one - 1))
	else:
		print(one)
		print('1 ' * one)


def calc(a):
	units = sum(a)
	zeroes = len(a) - units
	if units > zeroes:
		res = [1] * (units - units % 2)
	else:
		res = [0] * zeroes
	return res

def get_ints():
	return [int(n) for n in input().split()]

def get_floats():
	return [float(n) for n in input().split()]

def seq2str(seq):
	return ' '.join((str(item) for item in seq))
zzz = get_ints()
assert len(zzz) == 1
t = zzz[0]
for i in range(t):
	zzz = get_ints()
	assert len(zzz) == 1
	n = zzz[0]
	zzz = get_ints()
	assert len(zzz) == n
	a = zzz
	res = calc(a)
	print(len(res))
	print(seq2str(res))


from sys import stdin, gettrace
if gettrace():
	inputi = input
else:

	def input():
		return next(stdin)[:-1]

	def inputi():
		return stdin.buffer.readline()

def solve():
	n = int(inputi())
	aa = [int(a) for a in inputi().split()]
	z = aa.count(0)
	if z >= n // 2:
		print(z)
		print('0 ' * z)
	elif (n - z) % 2 == 0:
		print(n - z)
		print('1 ' * (n - z))
	else:
		print(n - z - 1)
		print('1 ' * (n - z - 1))

def main():
	t = int(inputi())
	for _ in range(t):
		solve()
main()


ii = lambda : int(input())
il = lambda : list(map(int, input().split()))
for _ in range(ii()):
	c = 0
	c = 1
	n = ii()
	a = il()
	c = c + 1
	if a.count(0) >= a.count(1):
		l = [0] * a.count(0)
		print(len(l))
		print(*l)
	else:
		c = 0
		if a.count(1) % 2 != 0:
			l = [1] * (a.count(1) - 1)
			print(len(l))
			print(*l)
		else:
			c = 0
			l = [1] * a.count(1)
			print(len(l))
			print(*l)
			c = c + 1


n = int(input())
for i in range(n):
	l = int(input())
	a = list(map(int, input().split()))
	kol_0 = 0
	kol_1 = 0
	for i in range(len(a)):
		if a[i] == 0:
			kol_0 += 1
		else:
			kol_1 += 1
	otv = []
	if kol_0 >= kol_1:
		otv = [0] * kol_0
	elif kol_1 % 2 == 0:
		otv = [1] * kol_1
	elif kol_1 - kol_0 > 1:
		otv = [1] * (kol_1 - 1)
	elif a[-1] == 0:
		otv = [1] * (kol_1 - 1)
		otv.append(0)
	elif a[0] == 1:
		otv = [1] + [0] * (kol_1 - 1) + [1]
	else:
		otv = [0] + [1] * (kol_1 - 1)
	print(len(otv))
	print(*otv)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	ev = 0
	od = 0
	for i in arr:
		if i == 0:
			ev = ev + 1
		else:
			od = od + 1
	if 2 * ev >= n:
		print(ev)
		for j in range(ev):
			print(0, end=' ')
		print()
	else:
		r = od // 2
		odd = r * 2
		print(odd)
		for j in range(odd):
			print(1, end=' ')
		print()


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	if len(set(a)) == 1:
		print(n)
		print(*a)
	elif a.count(0) >= n // 2:
		ans = [0] * (n // 2)
		print(n // 2)
		print(*ans)
	else:
		res = n // 2
		if res % 2 == 0:
			ans = [1] * (n // 2)
		else:
			ans = [1] * (n // 2 + 1)
		print(len(ans))
		print(*ans)


t = int(input())
for i in range(t):
	n = int(input())
	list1 = list(map(int, input().split()))
	m = n // 2
	if list1.count(1) > list1.count(0):
		if list1.count(0) != 0:
			if m % 2 == 0:
				print(m)
				print('1 ' * m)
			else:
				print(m + 1)
				print('1 ' * (m + 1))
		else:
			print(n)
			for l in range(n):
				print(list1[l], end=' ')
	elif list1.count(1) < list1.count(0):
		if list1.count(1) != 0:
			print(m)
			print('0 ' * m)
		else:
			print(n)
			for l in range(n):
				print(list1[l], end=' ')
	else:
		print(m)
		print('0 ' * m)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	d = a.count(1)
	c = n - d
	if c >= d:
		for j in range(n - 1, -1, -1):
			if a[j] == 1:
				del a[j]
	else:
		for j in range(n - 1, -1, -1):
			if a[j] == 0:
				del a[j]
		if d % 2 == 1:
			del a[-1]
	print(len(a))
	print(' '.join(map(str, a)))


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	cnt1 = 0
	for i in a:
		if i == 1:
			cnt1 += 1
	(m, e) = (-1, -1)
	if cnt1 <= n >> 1:
		m = n - cnt1
		e = 0
	else:
		m = cnt1
		e = 1
		if m & 1:
			m -= 1
	print(m)
	for i in range(m):
		print(e, end=' ')
	print()
for _ in range(int(input())):
	solve()


import sys, collections, math

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def input():
	return sys.stdin.readline().strip()
mod = 1000000007
for _ in range(int(input())):
	n = int(input())
	arr = get_array()
	z = arr.count(0)
	o = arr.count(1)
	if o <= n // 2:
		print(z)
		print(*[0] * z)
	elif z < n // 2:
		if o % 2 == 0:
			print(o)
			print(*[1] * o)
		else:
			print(o - 1)
			print(*[1] * (o - 1))


def solve(arr, s):
	temp = []
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	s = sum(arr)
	if s > n // 2:
		temp = [1] * (2 * (s // 2))
	elif s == 0:
		temp = [0] * n
	elif s == n // 2:
		temp = [0] * s
	else:
		temp = [0] * (2 * ((n - s) // 2))
		if len(temp) == 0:
			temp = [0]
	print(len(temp))
	print(*temp)


def linput():
	return [int(i) for i in input().split()]

def nod(a, b):
	while a != 0 and b != 0:
		if a > b:
			a = a % b
		else:
			b = b % a
	return a + b
qwertyyyyyy = int(input())
for ______ in range(qwertyyyyyy):
	n = int(input())
	q = linput()
	if q.count(0) >= n // 2:
		print(q.count(0))
		print('0 ' * q.count(0))
	elif q.count(0) % 2 == 0:
		print(n - q.count(0))
		print('1 ' * q.count(1))
	else:
		print(n - q.count(0) - 1)
		print('1 ' * (q.count(1) - 1))


import sys
import math
input = sys.stdin.readline
from collections import deque
from queue import LifoQueue
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(zero, one) = (0, 0)
	for i in range(n):
		if a[i] == 0:
			zero += 1
		else:
			one += 1
			O = i
	if one == zero:
		pp = [0] * zero
		print(zero)
		print(*pp)
	elif one < zero:
		print(zero)
		pp = [0] * zero
		print(*pp)
	elif one % 2 == 1:
		print(one - 1)
		pp = [1] * (one - 1)
		print(*pp)
	else:
		print(one)
		pp = [1] * one
		print(*pp)


for _ in range(int(input())):
	n = int(input())
	data = list(map(int, input().split()))
	zero = 0
	one = 0
	for x in data:
		if x == 0:
			zero += 1
		else:
			one += 1
	if zero >= one:
		print(zero)
		for i in range(zero):
			print(0, end=' ')
	else:
		print(one // 2 * 2)
		for i in range(one // 2 * 2):
			print(1, end=' ')
	print()


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	a = sum(arr)
	ans = []
	if a <= n / 2:
		print(n - a)
		assert n - a >= n / 2
		for i in range(n - a):
			print(0, end=' ')
	else:
		if a % 2 != 0:
			a -= 1
		print(a)
		assert a >= n / 2
		for i in range(a):
			print(1, end=' ')
	print()


t = int(input())
for T in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	cnt1 = l.count(1)
	cnt2 = l.count(0)
	if cnt1 <= n // 2:
		print(cnt2)
		for i in range(cnt2):
			print(0, end=' ')
	else:
		print(cnt1 - cnt1 % 2)
		for i in range(cnt1 - cnt1 % 2):
			print(1, end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	ones = sum(a)
	if ones <= n // 2:
		print(n - ones)
		print('0 ' * (n - ones))
	else:
		ones = ones - ones % 2
		print(ones)
		print('1 ' * ones)


for i in range(int(input())):
	b = input()
	a = list(map(int, input().split()))
	if a.count(1) <= a.count(0):
		print(a.count(0))
		print(*['0'] * a.count(0), sep=' ')
	else:
		print(a.count(1) - 1 if a.count(1) % 2 else a.count(1))
		print(*['1'] * (a.count(1) - 1 if a.count(1) % 2 else a.count(1)))


def main_function():
	t = int(input())
	data = []
	for i in range(t):
		n = int(input())
		data.append([int(i) for i in input().split(' ')])
	for j in data:
		a = j
		zero_counter = [0, 0]
		one_counter = [0, 1]
		for i in a:
			if i == 0:
				zero_counter[0] += 1
			else:
				one_counter[0] += 1
		s = sorted([zero_counter, one_counter], key=lambda x: (x[0], -x[1]))
		max_val = s[1][1]
		max_count = s[1][0]
		if max_count > len(a) // 2 and max_count % 2 == 1:
			max_count -= 1
		print(max_count)
		for n in range(max_count):
			if n == max_count - 1:
				print(max_val)
			else:
				print(max_val, end=' ')
main_function()


def haha(n, array):
	zeros = 0
	ones = 0
	for x in array:
		if x == 0:
			zeros += 1
		else:
			ones += 1
	if ones == zeros:
		return [int(n / 2), [0] * int(n / 2)]
	elif ones > zeros:
		if ones % 2 == 0:
			return [ones, [1] * ones]
		else:
			return [ones - 1, [1] * (ones - 1)]
	else:
		return [zeros, [0] * zeros]
t = int(input())
final = []
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	final.append(haha(n, l))
for _ in range(t):
	print(final[_][0])
	for x in final[_][1]:
		print(x, end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	one = a.count(1)
	if one <= n / 2:
		a = [x for x in a if x != 1]
		print(len(a))
		print(*a)
	elif one % 2 == 0:
		a = [x for x in a if x == 1]
		print(len(a))
		print(*a)
	else:
		a = [x for x in a if x == 1]
		a.pop()
		print(len(a))
		print(*a)


def solve():
	n = int(input())
	arr = [int(v) for v in input().split()]
	sm = sum(arr)
	if sm <= n // 2:
		print(n - sm)
		print(*[v for v in arr if not v])
	else:
		ans = [1] * sm
		if sm % 2 != 0:
			ans.pop(-1)
		print(len(ans))
		print(*ans)
t = int(input())
for _ in range(t):
	solve()


from collections import Counter

def B1():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = [int(i) for i in input().split()]
		dicti = dict(Counter(a))
		zeros = ones = 0
		if 0 in dicti:
			zeros = dicti.get(0)
		if 1 in dicti:
			ones = dicti.get(1)
		if ones <= n / 2:
			ans = [0 for i in range(n - ones)]
		elif zeros < n / 2:
			if ones % 2:
				k = zeros + 1
			else:
				k = zeros
			ans = [1 for i in range(n - k)]
		print(len(ans))
		print(*ans)
B1()


tst = int(input())
t = 1
while t <= tst:
	n = int(input())
	ls = list(map(int, input().split()))
	odd = even = i = 0
	while i < n:
		x = ls[i]
		if x == 1:
			odd += 1
		else:
			even += 1
		i += 1
	if odd == even:
		print(even)
		i = 1
		while i <= even:
			print(0, end=' ')
			i += 1
	elif even > odd:
		print(even)
		i = 1
		while i <= even:
			print(0, end=' ')
			i += 1
	else:
		if odd % 2 == 1:
			odd -= 1
		print(odd)
		i = 1
		while i <= odd:
			print(1, end=' ')
			i += 1
	print('\r')
	t += 1


t = int(input())
for _ in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	z = A.count(0)
	o = A.count(1)
	if z >= o:
		print(z)
		print(' '.join(map(str, [0] * z)))
	else:
		if o % 2 != 0:
			o -= 1
		print(o)
		print(' '.join(map(str, [1] * o)))


def solve(n, arr):
	zero_count = arr.count(0)
	if zero_count >= n / 2:
		print(zero_count)
		return '0 ' * zero_count
	elif zero_count % 2 == 0:
		print(n - zero_count)
		return '1 ' * (n - zero_count)
	else:
		print(n - zero_count - 1)
		return '1 ' * (n - zero_count - 1)
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	print(solve(n, arr))


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ze = a.count(0)
	on = a.count(1)
	ch = '1' if on > ze else '0'
	amo = max(on, ze)
	if ze == amo:
		print(amo)
		print(' '.join([ch] * max(on, ze)))
	else:
		print(amo - amo % 2)
		amo = amo - amo % 2
		print(' '.join([ch] * amo))


for _ in range(int(input())):
	n = int(input())
	a = map(int, input().split())
	count0 = 0
	count1 = 0
	result = []
	for i in a:
		if i == 0:
			count0 += 1
		else:
			count1 += 1
	if count0 >= count1:
		result = [0] * count0
	elif count1 % 2 == 1:
		result = [1] * (count1 - 1)
	else:
		result = [1] * count1
	print(len(result))
	print(*result)


for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	a = 0
	for i in range(n):
		if li[i] == 0:
			a += 1
	if a >= n // 2:
		print(a)
		print(' '.join(['0'] * a))
	elif n // 2 % 2 == 0:
		print(n // 2)
		print(' '.join(['1'] * (n // 2)))
	else:
		print(n // 2 + 1)
		print(' '.join(['1'] * (n // 2 + 1)))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	n_0 = 0
	n_1 = 0
	c = 0
	for i in l:
		if i == 1:
			n_1 += 1
		else:
			n_0 += 1
	if n_1 <= n // 2:
		print(n_0)
		for i in range(n_0):
			print(0, end=' ')
		print()
	elif n_1 % 2 == 0:
		print(n_1)
		for i in range(n_1):
			print(1, end=' ')
		print()
	else:
		print(n_1 - 1)
		for i in range(n_1 - 1):
			print(1, end=' ')
		print()


from sys import stdin
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1000000000.0) + 7
inf = float('inf')
import math
(t,) = gil()
from collections import Counter
for _ in range(t):
	(n,) = gil()
	a = gil()
	b = Counter(a)
	b[1] = max(0, b.get(1, 0) - (b.get(1, 0) & 1))
	if b.get(0, 0) >= n // 2:
		print(b.get(0))
		print('0 ' * b.get(0))
	elif b.get(1, 0) >= n // 2:
		print(b.get(1))
		print('1 ' * b.get(1))


t = int(input())
while t:
	n = int(input())
	arr = list(map(int, input().split()))
	a = arr.count(0)
	b = arr.count(1)
	c = n - a
	if a >= n // 2:
		print(a)
		for i in range(a):
			print(0, end=' ')
		print()
	elif b % 2 == 0:
		print(b)
		for i in range(b):
			print(1, end=' ')
		print()
	else:
		print(b - 1)
		for i in range(b - 1):
			print(1, end=' ')
		print()
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	while False:
		break
	ek = 0
	less = 0
	for xx in a:
		if xx == 1:
			ek += 1
		else:
			less += 1
		while False:
			break
	if ek <= n // 2:
		print(less)
		for j in range(less):
			print(0, end=' ')
	else:
		while False:
			break
		if less % 2 == 1 and n != 2:
			ek -= 1
		print(ek)
		for j in range(ek):
			print(1, end=' ')
	print('')


t = int(input())
for _ in range(t):
	n = int(input())
	numbers = list(map(int, input().split(' ')))
	count_0 = 0
	count_1 = 0
	for i in numbers:
		if i == 0:
			count_0 += 1
		else:
			count_1 += 1
	if count_0 >= n / 2:
		print(count_0)
		for i in range(count_0):
			print(0, end=' ')
	else:
		print(count_1 - count_1 % 2)
		for i in range(count_1 - count_1 % 2):
			print(1, end=' ')
	print('')


import math
from copy import copy
t = input()
t = int(t)
while t > 0:
	n = input()
	n = int(n)
	s = input()
	a = [int(x) for x in s.split()]
	cnt1 = sum(a)
	cnt0 = len(a) - cnt1
	if cnt0 >= len(a) / 2:
		print(cnt0)
		print(' '.join([str(0) for _ in range(cnt0)]))
	else:
		print(cnt1 - cnt1 % 2)
		print(' '.join([str(1) for _ in range(cnt1 - cnt1 % 2)]))
	t -= 1


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	hash = defaultdict(int)
	for i in l:
		hash[i] += 1
	if hash[0] == hash[1]:
		print(n // 2)
		print(*[0] * (n // 2))
	elif hash[0] > hash[1]:
		print(hash[0])
		print(*[0] * hash[0])
	elif hash[1] % 2 == 0:
		print(hash[1])
		print(*[1] * hash[1])
	else:
		print(hash[1] - 1)
		print(*[1] * (hash[1] - 1))


import sys
t = int(sys.stdin.readline().strip())
for i in range(t):
	n = int(sys.stdin.readline())
	arr = list(map(int, sys.stdin.readline().split()))
	x = arr.count(0)
	y = arr.count(1)
	if x >= n / 2:
		print(x)
		for j in range(x):
			print('0', end=' ')
		print('')
	elif y % 2 == 0:
		print(y)
		for j in range(y):
			print('1', end=' ')
		print('')
	else:
		print(y - 1)
		for j in range(y - 1):
			print('1', end=' ')
		print('')


for t in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	c1 = l.count(0)
	c2 = l.count(1)
	if c2 <= n // 2:
		for i in range(c2):
			l.remove(1)
	elif c1 < n // 2:
		for i in range(c1):
			l.remove(0)
		if c2 % 2 == 1:
			l.remove(1)
	print(len(l))
	print(' '.join(map(str, l)))


for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	zcount = lis.count(0)
	ocount = n - zcount
	if zcount >= n // 2:
		print(zcount)
		print('0 ' * zcount)
	else:
		if ocount & 1:
			ocount -= 1
		print(ocount)
		print(ocount * '1 ')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ze = a.count(0)
	on = a.count(1)
	if ze >= on:
		print(ze)
		print('0 ' * ze)
	elif on % 2 == 0:
		print(on)
		print('1 ' * on)
	elif on % 2 != 0:
		print(on - 1)
		print('1 ' * (on - 1))


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	z = a.count(0)
	o = a.count(1)
	if z >= n // 2:
		print(z)
		for i in range(z):
			print(0, end=' ')
	elif o > n // 2:
		print(n // 2 + n // 2 % 2)
		if n // 2 % 2 != 0:
			print(1, end=' ')
		for i in range(n // 2):
			print(1, end=' ')
	print('')


for i in range(int(input())):
	n = int(input())
	a = input().split()
	k = a.count('0')
	l = a.count('1')
	r = ''
	if n % 2 == 0:
		if k >= l:
			f = k
			for i in range(k):
				r += '0' + ' '
		else:
			if l % 2 != 0:
				l -= 1
			f = l
			for i in range(l):
				r += '1' + ' '
	elif k > l:
		f = k
		for i in range(k):
			r += '0' + ' '
	elif l == int(n / 2) + 1:
		r = '0 '
		f = l
		for i in range(l - 1):
			r += '1' + ' '
	elif l % 2 != 0:
		l -= 1
		f = l
		for i in range(l):
			r += '1' + ' '
	else:
		f = l
		for i in range(l):
			r += '1' + ' '
	print(f)
	print(r)


def main():
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		(a0, a1) = (a.count(0), a.count(1))
		if a0 >= a1:
			print(a0)
			print(*[0] * a0)
		else:
			if a1 % 2 == 1:
				a1 -= 1
			print(a1)
			print(*[1] * a1)
main()


T = input()
T = int(T)
for t in range(T):
	n = int(input())
	arr = [int(v) for v in input().split()]
	zeros_count = 0
	ones_count = 0
	for a in arr:
		if a:
			ones_count += 1
		else:
			zeros_count += 1
	if ones_count > zeros_count:
		res = ' '.join(['1' for _ in range(ones_count - ones_count % 2)])
	else:
		res = ' '.join(['0' for _ in range(zeros_count)])
	k = (len(res) + 1) // 2
	print(k)
	print(res)


def op(val, n):
	print(n)
	for i in range(n):
		print(val, end=' ')
	print()
for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	x = a.count(1)
	y = n - x
	if y >= n // 2:
		op(0, y)
	elif x % 2 == 0:
		op(1, x)
	else:
		op(1, x - 1)


for _ in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	zs = s.count(0)
	os = s.count(1)
	k = n // 2
	k += k % 2
	if zs >= k:
		print(k)
		print('0 ' * k)
	elif os >= k:
		print(k)
		print('1 ' * k)
	else:
		print(n // 2)
		print('0 ' * (n // 2))


import math

class Read:

	@staticmethod
	def string():
		return input()

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def list(sep=' '):
		return input().split(sep)

	@staticmethod
	def list_int(sep=' '):
		return list(map(int, input().split(sep)))

def solve():
	n = Read.int()
	a = Read.list()
	zero = 0
	one = 0
	for i in a:
		if i == '0':
			zero = zero + 1
		else:
			one = one + 1
	if one > zero:
		c = one if one % 2 == 0 else one - 1
		f = '1'
	else:
		c = zero
		f = '0'
	res = ''
	for i in range(c):
		res = res + f + ' '
	print(c)
	print(res)
query_count = Read.int()
while query_count:
	query_count -= 1
	solve()


import sys
import bisect as bi
import math
from collections import defaultdict as dd
import heapq
import itertools
input = sys.stdin.readline
import random
mo = 10 ** 9 + 7

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
for _ in range(inin()):
	n = inin()
	l = ain()
	c1 = l.count(1)
	c0 = l.count(0)
	if c1 > n // 2:
		if n % 4 == 0:
			print(n // 2)
			print(*[1] * (n // 2))
		else:
			print(n // 2 + 1)
			print(*[1] * (n // 2 + 1))
	elif c0 > n // 2:
		if n % 4 == 0:
			print(n // 2)
			print(*[0] * (n // 2))
		else:
			print(n // 2 + 1)
			print(*[0] * (n // 2 + 1))
	else:
		print(n // 2)
		print(*[0] * (n // 2))


for i in range(int(input())):
	n = int(input())
	l = [int(c) for c in input().split()]
	c1 = 0
	c2 = 0
	t = []
	p = []
	for i in range(n):
		if l[i] == 1:
			t.append(i)
			c1 += 1
		else:
			p.append(i)
			c2 += 1
	if c1 == c2:
		print(c1)
		l = [0] * c1
		print(*l)
	elif c1 > c2:
		if c1 % 2 == 0:
			print(c1)
			l = [1] * c1
			print(*l)
		else:
			c1 -= 1
			print(c1)
			l = [1] * c1
			print(*l)
	else:
		print(c2)
		l = [0] * c2
		print(*l)


from sys import stdin, stdout
import math
from collections import Counter, deque
L = lambda : list(map(int, stdin.readline().strip().split()))
M = lambda : map(int, stdin.readline().strip().split())
I = lambda : int(stdin.readline().strip())
S = lambda : stdin.readline().strip()
C = lambda : stdin.readline().strip().split()
mod = 1000000007

def pr(a):
	print(' '.join(list(map(str, a))))

def solve():
	n = I()
	a = L()
	o = 0
	e = 0
	for i in range(n):
		if a[i] == 1:
			o += 1
		else:
			e += 1
	if o == e:
		print(e)
		print('0 ' * e)
	elif o > e:
		if o % 2 == 0:
			print(o)
			print('1 ' * o)
		else:
			print(o - 1)
			print('1 ' * (o - 1))
	elif e % 2 == 0:
		print(e)
		print('0 ' * e)
	else:
		print(e - 1)
		print('0 ' * (e - 1))
for _ in range(I()):
	solve()


t = 1
t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	(ones, zero) = (a.count(1), a.count(0))
	if ones > zero:
		print(ones - ones % 2)
		for i in range(ones - ones % 2):
			print(1, end=' ')
	else:
		print(zero)
		for i in range(zero):
			print(0, end=' ')
	print()


def zeroSum(a):
	if a.count(1) <= len(a) / 2:
		x = [0 for i in range(a.count(1), len(a))]
	else:
		x = [1 for i in range(a.count(1))]
	if 1 in x and len(x) % 2 == 1:
		x.pop()
	return x
trials = int(input())
for i in range(trials):
	n = int(input())
	binary = list(map(int, input().strip().split()))
	ans = zeroSum(binary)
	print(f"{len(ans)}\n{' '.join(map(str, ans))}")


import sys
import random
from fractions import Fraction
from math import *

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def finput():
	return float(input())

def tinput():
	return input().split()

def linput():
	return list(input())

def rinput():
	return map(int, tinput())

def fiinput():
	return map(float, tinput())

def flinput():
	return list(fiinput())

def rlinput():
	return list(map(int, input().split()))

def trinput():
	return tuple(rinput())

def srlinput():
	return sorted(list(map(int, input().split())))

def NOYES(fl):
	if fl:
		print('NO')
	else:
		print('YES')

def YESNO(fl):
	if fl:
		print('YES')
	else:
		print('NO')

def main():
	n = iinput()
	q = rlinput()
	o = q.count(1)
	z = n - o
	if o > n // 2:
		res = n - z - o % 2
		print(res)
		print('1 ' * res)
	else:
		res = n - o
		print(res)
		print('0 ' * res)
for TESTING in range(iinput()):
	main()


import sys
from collections import defaultdict as dd
from collections import Counter as cc
from queue import Queue
import math
import itertools
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = lambda : sys.stdin.buffer.readline().rstrip()
for _ in range(int(input())):
	q = int(input())
	w = list(map(int, input().split()))
	e = w.count(1)
	r = w.count(0)
	if e > r:
		if e % 2 == 0:
			print(e)
			print(*[1] * e)
		else:
			print(e - 1)
			print(*[1] * (e - 1))
	else:
		print(r)
		print(*[0] * r)


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 0
	cnt1 = 0
	for i in a:
		if i:
			cnt1 += 1
	cnt0 = n - cnt1
	if cnt0 >= n // 2:
		print(cnt0)
		for i in range(cnt0):
			print(0, end=' ')
	else:
		print(cnt1 - cnt1 % 2)
		for i in range(cnt1 - cnt1 % 2):
			print(1, end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	zero = a.count(0)
	one = a.count(1)
	if zero >= n // 2:
		print(zero)
		for _ in range(zero):
			print('0', end=' ')
	elif one >= n // 2:
		if n // 2 % 2 != 0:
			print(n // 2 + 1)
			for _ in range(n // 2 + 1):
				print('1', end=' ')
		else:
			print(n // 2)
			for _ in range(n // 2):
				print('1', end=' ')
	print()


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	z = arr.count(0)
	k = len(arr) // 2
	if z >= k:
		ns = (z, ' '.join(['0'] * z))
	elif k % 2 == 0:
		ns = (k, ' '.join(['1'] * k))
	else:
		ns = (k + 1, ' '.join(['1'] * (k + 1)))
	ans.append(ns)
for i in range(t):
	ns = ans[i]
	print(ns[0])
	print(ns[1])


def solve(n, a):
	c = 0
	for i in a:
		if i == 0:
			c += 1
	if c >= n // 2:
		return (c, '0 ' * c)
	elif (n - c) % 2 == 0:
		return (n - c, '1 ' * (n - c))
	else:
		return (n - c - 1, '1 ' * (n - c - 1))
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ans = list(solve(n, a))
	print(ans[0])
	print(ans[1])


from sys import stdin, stdout
from collections import Counter
from itertools import permutations
import bisect
import math
I = lambda : map(int, stdin.readline().split())
I1 = lambda : stdin.readline()
for _ in range(int(I1())):
	n = int(I1())
	a = list(I())
	c0 = a.count(0)
	c1 = a.count(1)
	if c0 >= n // 2:
		print(c0)
		for i in range(c0):
			print(0, end=' ')
		print()
	else:
		if c1 % 2 != 0:
			c1 -= 1
		print(c1)
		for i in range(c1):
			print(1, end=' ')
		print()


import sys

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())
testCases = int(input())
while testCases != 0:
	n = int(input())
	a = get_list()
	x = 0
	y = 0
	for i in a:
		if i == 0:
			x += 1
		else:
			y += 1
	if x >= n // 2:
		print(x)
		print('0 ' * x)
	else:
		print(y - y % 2)
		print('1 ' * (y - y % 2))
	testCases -= 1


t = int(input())
for j in range(t):
	n = int(input())
	lista = list(map(int, input().split()))
	count1 = 0
	count0 = 0
	for i in range(n):
		if lista[i] == 1:
			count1 += 1
		else:
			count0 += 1
	if count1 <= count0:
		print(count0)
		for i in range(count0):
			print(0, end=' ')
		print()
	elif count1 % 2 == 0:
		print(count1)
		for i in range(count1):
			print(1, end=' ')
		print()
	else:
		print(count1 - 1)
		for i in range(count1 - 1):
			print(1, end=' ')
		print()


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = []
	(cnt0, cnt1) = (0, 0)
	k = 0
	for i in arr:
		if i == 0:
			cnt0 += 1
		else:
			cnt1 += 1
	if cnt0 >= cnt1:
		ans = [0] * cnt0
		k = cnt0
	elif cnt1 % 2 == 0:
		ans = [1] * cnt1
		k = cnt1
	else:
		ans = [1] * cnt1
		if cnt1 - 1 >= n // 2:
			ans.remove(1)
			k = cnt1 - 1
		else:
			ans.insert(arr.find(0), 0)
			k = cnt1 + 1
	print(k)
	print(*ans)


test = int(input())
for _ in range(test):
	n = int(input())
	arr = list(map(int, input().split()))
	(on, ze) = (0, 0)
	for i in range(n):
		if arr[i] == 1:
			on += 1
		else:
			ze += 1
	if on <= n // 2:
		print(n - on)
		for i in range(n - on):
			print(0, end=' ')
		print()
	elif ze % 2:
		print(on - 1)
		for i in range(on - 1):
			print(1, end=' ')
		print()
	else:
		print(n - ze)
		for i in range(n - ze):
			print(1, end=' ')
		print()


import sys
import math

def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def MI():
	return map(int, sys.stdin.readline().split())

def SI():
	return sys.stdin.readline().strip()
t = II()
for q in range(t):
	n = II()
	a = LI()
	ans = []
	c = a.count(0)
	if c < n // 2:
		if c % 2 == 0:
			for i in range(n):
				if a[i] != 0:
					ans.append(a[i])
		else:
			boo = False
			for i in range(n):
				if boo == True and a[i] == 1:
					ans.append(a[i])
				elif boo == False and a[i] == 1:
					boo = True
	else:
		for i in range(n):
			if a[i] != 1:
				ans.append(a[i])
	print(len(ans))
	print(*ans)


t = int(input())
for i in range(t):
	a = []
	n = int(input())
	a = [int(a) for a in input().split()]
	x = a.count(1)
	y = a.count(0)
	if n == 2:
		if a.count(1) == 1:
			print('1')
			print('0')
			continue
		else:
			print('2')
			[print(f, end=' ') for f in a]
			print(' ')
			continue
	if y >= n / 2:
		for j in range(n):
			if a[j] == 1:
				a[j] = 4
	elif x > n / 2:
		for j in range(n):
			if a[j] == 0:
				a[j] = 4
		if a.count(1) % 2 == 1:
			a[a.index(1)] = 4
	print(len(a) - a.count(4))
	for j in range(len(a)):
		if a[j] != 4:
			print(a[j], end=' ')
	print(' ')


for _ in range(int(input())):
	(n, a) = (int(input()), [x for x in input().split()])
	if a.count('0') >= n // 2:
		print(a.count('0'), '0 ' * a.count('0'), sep='\n')
	else:
		p = '1 ' * (a.count('1') - a.count('1') % 2)
		print(len(p.split()), p, sep='\n')


def solve(arr, n):
	count_zero = 0
	count_one = 0
	for x in arr:
		if x == 0:
			count_zero += 1
		else:
			count_one += 1
	if count_one > count_zero:
		if count_one & 1 == 0:
			return ones(count_one)
		else:
			return ones(count_one - 1)
	elif count_zero & 1 == 0:
		return zeros(count_zero)
	else:
		return zeros(count_zero)

def ones(a):
	return [1 for i in range(a)]

def zeros(b):
	return [0 for i in range(b)]
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	x = solve(arr, n)
	print(len(x))
	for i in x:
		print(int(i), end=' ')


n = int(input())
for i in range(n):
	nn = int(input())
	j = list(map(int, input().split()))
	ones = j.count(1)
	zeros = j.count(0)
	if zeros >= nn / 2:
		print(zeros)
		temp = ['0 ' for i in range(0, zeros)]
		print(''.join(temp).strip())
	else:
		print(ones - ones % 2)
		temp = ['1 ' for i in range(0, ones - ones % 2)]
		print(''.join(temp).strip())


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	no = a.count(1)
	nz = a.count(0)
	if nz >= no:
		print(nz)
		print(*[0] * nz)
	elif no % 2 == 0:
		print(no)
		print(*[1] * no)
	else:
		print(no - 1)
		print(*[1] * (no - 1))


N = int(input())
cnt0 = 0
for i in range(N):
	t = int(input())
	a = list(map(int, input().split()))
	cnt0 = a.count(0)
	cnt1 = t - cnt0
	ans = []
	if cnt0 >= t // 2:
		for j in range(cnt0):
			ans.append(0)
		print(cnt0)
		print(*ans)
	else:
		for j in range(cnt1 - cnt1 % 2):
			ans.append(1)
		print(cnt1 - cnt1 % 2)
		print(*ans)


for _ in range(int(input())):
	lens = int(input())
	arrs = [int(x) for x in input().split()]
	ones = sum(arrs)
	zero = lens - ones

	def print_arr(ch, times):
		for i in range(times):
			print(ch, end=' ')
		print()
	if ones > zero:
		if ones % 2:
			ones -= 1
		print(ones)
		print_arr('1', ones)
	else:
		print(zero)
		print_arr('0', zero)


for _ in range(int(input())):
	c = int(input())
	a = list(map(int, input().split()))
	ones = a.count(1)
	zero = a.count(0)
	flag = 0
	if zero < ones:
		flag = 1
		co = ones
	else:
		co = zero
	if co % 2 and co > c / 2:
		co = co - 1
	print(co)
	if flag:
		for i in range(co):
			print(1, end=' ')
	else:
		for i in range(co):
			print(0, end=' ')


T = int(input())
for _ in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	ct1 = sum(A)
	ct0 = N - ct1
	rem = 0
	if ct1 <= N // 2:
		print(ct0)
		print(*[0] * ct0, sep=' ')
	else:
		rem = ct1 - ct1 % 2
		print(rem)
		print(*[1] * rem, sep=' ')


for _ in range(int(input())):
	n = int(input())
	a = input().split()
	ans = ''
	oneCt = 0
	length = n
	for i in range(n):
		if a[i] == '1':
			oneCt += 1
	zeroCt = n - oneCt
	if oneCt > zeroCt:
		if oneCt % 2 == 0:
			print(length - zeroCt)
			print('1 ' * oneCt)
		else:
			print(length - zeroCt - 1)
			print('1 ' * (oneCt - 1))
	else:
		print(length - oneCt)
		print('0 ' * zeroCt)


def ans():
	n = int(input())
	a = list(map(int, input().split()))
	o = a.count(1)
	z = a.count(0)
	if z >= o:
		print(z, end='\n')
		l = [0 for i in range(z)]
		print(*l)
	else:
		if o & 1:
			o -= 1
		print(o, end='\n')
		l = [1 for i in range(o)]
		print(*l)

def solve():
	for _ in range(int(input())):
		ans()
solve()


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = [0, 0]
	for i in a:
		if i == 0:
			c[0] += 1
		else:
			c[1] += 1
	if c[1] <= n // 2:
		a = [i for i in a if i == 0]
		print(len(a))
		print(*a)
	else:
		a = [i for i in a if i == 1]
		if len(a) % 2 != 0:
			a.pop()
		print(len(a))
		print(*a)


for t in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	count_ones = arr.count(1)
	if count_ones <= n // 2:
		ans = [0] * (n - count_ones)
		print(len(ans))
		print(*ans)
	else:
		if count_ones % 2 == 1:
			count_ones -= 1
		ans = [1] * count_ones
		print(len(ans))
		print(*ans)


def answer(n, A):
	x = sum(A)
	if x > n // 2:
		if x % 2 == 0:
			return (x, [1] * x)
		else:
			return (x - 1, [1] * (x - 1))
	else:
		return (n - x, [0] * (n - x))
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	(a, b) = answer(n, arr)
	print(a)
	print(*b)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	countzero = a.count(0)
	countone = a.count(1)
	if countone > countzero:
		if countone % 2 != 0:
			print(countone - 1)
			print('1 ' * (countone - 1))
		else:
			print(countone)
			print('1 ' * countone)
	else:
		print(countzero)
		print('0 ' * countzero)


for _ in range(int(input())):
	n = int(input())
	arr = list(input().split())
	(num_zeros, num_ones) = (arr.count('0'), arr.count('1'))
	if num_zeros == num_ones:
		print(num_zeros)
		print(' '.join(['0'] * num_zeros))
	elif num_zeros > num_ones:
		k = num_zeros
		print(k)
		print(' '.join(['0'] * k))
	else:
		k = num_ones
		if k % 2 == 1:
			k -= 1
		print(k)
		print(' '.join(['1'] * k))


import sys
input = sys.stdin.readline
for nt in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = a.count(1)
	if c <= n // 2:
		x = n - c
		count = 0
		print(x)
		for i in a:
			if i == 1 and count < x:
				count += 1
				continue
			print(i, end=' ')
		print()
	else:
		x = c // 2 * 2
		count = 0
		print(x)
		for i in a:
			if i == 1 and count < x:
				print(i, end=' ')
				count += 1
			if count == x:
				break
		print()


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	n1 = arr.count(1)
	n0 = n - n1
	if n1 <= n // 2:
		res = [0] * n0
		print(len(res))
		print(*res)
	else:
		if n1 % 2 == 0:
			res = [1] * n1
		else:
			res = [1] * (n1 - 1)
		print(len(res))
		print(*res)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	on = sum(a)
	k = n
	b = [1] * n
	t = 0
	if on <= n // 2:
		t = 1
	p = 0
	for (i, x) in enumerate(a):
		if x == t:
			b[i] = 0
			k -= 1
		else:
			p = i
	if k & 1 and t == 0:
		k -= 1
		b[p] = 0
	print(k)
	for (i, x) in enumerate(a):
		if b[i]:
			print(x, end=' ')
	print()


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	zero = 0
	one = 0
	has = Counter(arr)
	if has[0] >= n // 2:
		print(has[0])
		ans = has[0] * '0'
		res = []
		for i in range(has[0]):
			res.append(0)
		print(*res)
	else:
		if has[1] % 2 != 0:
			has[1] -= 1
		print(has[1])
		for i in range(has[1]):
			print(1, end=' ')
		print()


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(j) for j in input().split()]
	o = arr.count(1)
	z = arr.count(0)
	if o > z:
		if (n - z) % 2 == 1:
			print(n - z - 1)
			print(*[1] * (n - z - 1))
		else:
			print(n - z)
			print(*[1] * (n - z))
	else:
		print(n - o)
		print(*[0] * (n - o))


import atexit
import io
import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
for case in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	ones = sum(a)
	zeros = n - ones
	half = n // 2
	if ones == zeros:
		ans = [0] * zeros
	elif ones > zeros:
		ans = [1] * (n // 2)
		if half % 2:
			ans.append(1)
	else:
		ans = [0] * (n // 2)
		if half % 2:
			ans.append(0)
	print(len(ans))
	print(*ans)


for _ in range(int(input())):
	x = int(input())
	li = list(map(int, input().split()))
	a = li.count(1)
	b = li.count(0)
	if a > b:
		print(a // 2 * 2)
		li1 = [1] * (a // 2 * 2)
	else:
		print(b)
		li1 = [0] * b
	print(*li1)


import math

def solve(n, a):
	if a.count(1) <= n // 2:
		return [0 for i in range(n - a.count(1))]
	elif a.count(1) % 2:
		return [1 for i in range(a.count(1) - 1)]
	else:
		return [1 for i in range(a.count(1))]
t = int(input())
for t in range(t):
	n = int(input())
	a = [int(s) for s in input().split()]
	result = solve(n, a)
	print(len(result))
	print(' '.join([str(result[i]) for i in range(len(result))]))


t = int(input())
for _ in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	c0 = 0
	c1 = 0
	for a in A:
		if a == 0:
			c0 += 1
		else:
			c1 += 1
	if c0 >= c1:
		print(n - c1)
		ans = [0] * c0
		print(*ans)
	elif c1 % 2 == 0:
		print(n - c0)
		ans = [1] * c1
		print(*ans)
	else:
		print(n - c0 - 1)
		ans = [1] * (c1 - 1)
		print(*ans)


t = int(input())
for i in range(t):
	n = int(input())
	l = [int(i) for i in input().split()]
	ones = l.count(1)
	zeros = l.count(0)
	if ones > zeros:
		if ones % 2 == 1:
			ones -= 1
		print(ones)
		print(*[1] * ones)
	else:
		print(zeros)
		print(*[0] * zeros)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	k = 0
	if n == 2:
		if l[0] - l[1] != 0:
			print(1)
			print(0)
		else:
			print(2)
			print(*l)
	else:
		x = l.count(0)
		y = l.count(1)
		if x >= n // 2:
			print(n // 2)
			print(*[0 for i in range(n // 2)])
		elif n // 2 % 2 != 0:
			if y >= n // 2 + 1:
				print(n // 2 + 1)
				print(*[1 for i in range(n // 2 + 1)])
		else:
			print(n // 2)
			print(*[1 for i in range(n // 2)])


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	x = arr.count(0)
	if x >= n // 2:
		out = [0] * x
	else:
		out = [1] * ((n - x) // 2) * 2
	print(len(out))
	print(*out)


T = int(input())
for _ in range(0, T):
	n = int(input())
	s = [int(x) for x in input().split()]
	c0 = 0
	c1 = 0
	for i in range(0, len(s)):
		if s[i] == 0:
			c0 += 1
		else:
			c1 += 1
	if c0 >= c1:
		L = []
		for i in range(c0):
			L.append(0)
		print(len(L))
		print(*L)
	else:
		L = []
		for i in range(c1):
			L.append(1)
		if len(L) % 2 != 0 and len(L) > 1:
			L = L[1:]
		print(len(L))
		print(*L)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	ans = []
	cnt0 = cnt1 = 0
	value = 0
	for i in l:
		if i == 1:
			cnt1 += 1
		else:
			cnt0 += 1
	if cnt0 >= n // 2:
		value = cnt0
		ans = [0] * cnt0
	elif cnt1 % 2 == 1:
		value = cnt1 - 1
		ans = [1] * (cnt1 - 1)
	else:
		value = cnt1
		ans = [1] * cnt1
	print(value)
	print(*ans)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	num1 = 0
	num0 = 0
	for i in arr:
		if i == 0:
			num0 += 1
		else:
			num1 += 1
	if num0 >= num1:
		print(num0)
		for i in range(num0):
			print(0, end=' ')
		print()
	elif num1 % 2 == 0:
		print(num1)
		for i in range(num1):
			print(1, end=' ')
		print()
	else:
		print(num1 - 1)
		for i in range(num1 - 1):
			print(1, end=' ')
		print()


for tt in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	b = [n - sum(arr), sum(arr)]
	i = 1 if b[1] * 2 > n else 0
	k = b[i] - b[i] % 2 * i
	print(k)
	print(*[i] * k)


for i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	one = 0
	zero = 0
	for j in range(n):
		if arr[j] == 0:
			zero += 1
		else:
			one += 1
	if zero >= one:
		print(zero)
		for j in range(zero):
			print('0 ', end='')
	else:
		if one & 1:
			one -= 1
		print(one)
		for j in range(one):
			print('1 ', end='')


import sys
import math
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	zero = a.count(0)
	one = n - zero
	if zero >= n // 2:
		print(zero)
		print('0 ' * zero)
	else:
		one -= one % 2
		print(one)
		print('1 ' * one)


for i in range(int(input())):
	length = int(input())
	l = list(map(int, input().split()))
	c_0 = l.count(0)
	if c_0 >= length // 2:
		print(c_0)
		b = list(filter(1 .__ne__, l))
		print(*b, sep=' ')
	else:
		c_1 = length - c_0
		print(c_1 - c_1 % 2)
		b = list(filter(0 .__ne__, l))
		print(*b[0:c_1 - c_1 % 2], sep=' ')


import sys
for _ in range(int(input())):
	n = int(sys.stdin.readline())
	arr = list(map(int, sys.stdin.readline().split()))
	if sum(arr) <= n / 2:
		arr = [0 for i in range(n - sum(arr))]
	elif sum(arr) % 2 == 0:
		arr = [1 for i in range(sum(arr))]
	elif sum(arr) - 1 < n / 2:
		newarr = []
		for i in range(n):
			if arr[i] == 1 and len(newarr) != (n - 1) / 2:
				newarr.append(1)
			elif len(newarr) % 2 == 0 and arr[i] == 0:
				newarr.append(0)
				break
			elif arr[i] == arr[i + 1] and arr[i] == 0:
				newarr.append(0)
				newarr.append(0)
				break
			elif len(newarr) == (n - 1) / 2:
				newarr.append(0)
				break
		while sum(newarr) != (n - 1) / 2:
			newarr.append(1)
		arr = newarr
	else:
		arr = [1 for i in range(sum(arr) - 1)]
	print(len(arr))
	print(' '.join(map(str, arr)))


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	zero = 0
	one = 0
	for i in arr:
		if i == 1:
			one += 1
		else:
			zero += 1
	if one <= n / 2:
		print(zero)
		arr = ['0'] * zero
		s = ' '.join(arr)
		print(s)
	elif one % 2 == 0:
		print(one)
		arr = ['1'] * one
		s = ' '.join(arr)
		print(s)
	else:
		print(str(one - 1))
		arr = ['1'] * (one - 1)
		s = ' '.join(arr)
		print(s)


t = int(input())
for you in range(t):
	n = int(input())
	l = input().split()
	li = [int(i) for i in l]
	num0 = 0
	num1 = 0
	for i in li:
		if i == 0:
			num0 += 1
		else:
			num1 += 1
	if num0 >= n // 2:
		print(num0)
		for i in range(num0):
			print(0, end=' ')
	else:
		if num1 % 2:
			num1 -= 1
		print(num1)
		for i in range(num1):
			print(1, end=' ')
	print()


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	d = Counter(x)
	if d[1] <= n // 2:
		x = list(filter(lambda i: i != 1, x))
	else:
		x = list(filter(lambda i: i != 0, x))
		if d[1] % 2 != 0:
			x.remove(1)
	print(len(x))
	print(*x)


import sys
from collections import defaultdict
input = sys.stdin.readline
from collections import deque

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = inp()
for i in range(t):
	n = inp()
	tab = inlt()
	zeros = []
	uns = []
	for j in range(n):
		if tab[j] == 0:
			zeros.append(0)
		else:
			uns.append(1)
	if len(zeros) >= len(uns):
		res = zeros
	else:
		res = uns
	if len(res) % 2 == 1 and res[0] == 1:
		del res[0]
	print(len(res))
	stri = ''
	for l in range(len(res)):
		stri = stri + str(res[l]) + ' '
	print(stri)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	s1 = arr.count(1)
	s2 = arr.count(0)
	if s2 >= n // 2:
		print(s2)
		print('0 ' * s2)
	elif s1 % 2 == 1:
		print(s1 - 1)
		print('1 ' * (s1 - 1))
	else:
		print(s1)
		print('1 ' * s1)


test_case = int(input())
for i in range(test_case):
	n = int(input())
	s = input().split(' ')
	count_1 = 0
	count_0 = 0
	for j in range(n):
		if s[j] == '1':
			count_1 += 1
		else:
			count_0 += 1
	if count_0 >= n / 2:
		print(count_0)
		s = '0 ' * count_0
		print(s[:-1])
	else:
		print(count_1 // 2 * 2)
		s = '1 ' * (count_1 // 2 * 2)
		print(s[:-1])


for x in range(int(input())):
	n = int(input())
	a = input()
	cnt0 = a.count('0')
	cnt1 = a.count('1')
	if cnt1 <= n // 2:
		print(cnt0, '0 ' * cnt0)
	else:
		cnt1 = cnt1 - cnt1 % 2
		print(cnt1, '1 ' * cnt1)


for _ in range(int(input())):
	n = int(input())
	A = [int(_) for _ in input().split()]
	(x, y) = (0, 0)
	for _ in range(n):
		if A[_] == 0:
			x += 1
		else:
			y += 1
	if x >= y:
		print(x)
		print(*[0 for _ in range(x)])
	elif y % 2 == 1:
		print(y - 1)
		print(*[1 for _ in range(y - 1)])
	else:
		print(y)
		print(*[1 for _ in range(y)])


for t in range(int(input())):
	n = int(input())
	arr = [int(x) for x in input().split()]
	temp = sum(arr)
	if temp > n // 2:
		if temp % 2 == 0:
			a = [1] * temp
			print(temp)
			print(*a)
		else:
			a = [1] * (temp - 1)
			print(temp - 1)
			print(*a)
			continue
	elif temp < n // 2:
		print(n - temp)
		a = [0] * (n - temp)
		print(*a)
	else:
		print(n // 2)
		a = [0] * (n // 2)
		print(*a)


T = int(input())
for _ in range(T):
	n = int(input())
	x = list(map(int, input().split()))
	(a, b) = (0, 0)
	for i in range(len(x)):
		if x[i] == 1:
			a += 1
		else:
			b += 1
	if a > b:
		if a % 2 == 0:
			print(a)
			for i in range(a):
				print(1, end=' ')
			print()
		else:
			print(a - 1)
			for i in range(a - 1):
				print(1, end=' ')
			print()
	else:
		print(b)
		for i in range(b):
			print(0, end=' ')
		print()


from __future__ import division, print_function
from sys import stdin, stdout
import bisect
import math
import heapq
i_m = 9223372036854775807

def inin():
	return int(input())

def stin():
	return input()

def spin():
	return map(int, stin().split())

def lin():
	return list(map(int, stin().split()))

def matrix(n):
	return [list(map(int, input().split())) for i in range(n)]

def count2Dmatrix(i, list):
	return sum((c.count(i) for c in list))

def modinv(n, p):
	return pow(n, p - 2, p)

def GCD(x, y):
	x = abs(x)
	y = abs(y)
	if min(x, y) == 0:
		return max(x, y)
	while y:
		(x, y) = (y, x % y)
	return x

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l
prime = []

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f
q = []

def dfs(n, d, v, c):
	global q
	v[n] = 1
	x = d[n]
	q.append(n)
	j = c
	for i in x:
		if i not in v:
			f = dfs(i, d, v, c + 1)
			j = max(j, f)
	return j
for _ in range(inin()):
	n = inin()
	a = lin()
	(c0, c1) = (a.count(0), a.count(1))
	if c1 <= n // 2:
		print(c0)
		print(*[0] * c0)
	elif c1 % 2 != 0:
		print(c1 - 1)
		print(*[1] * (c1 - 1))
	else:
		print(c1)
		print(*[1] * c1)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	a = arr.count(0)
	b = arr.count(1)
	if b > n // 2:
		print(b - b % 2)
		print(*[1 for _ in range(b - b % 2)])
	elif b == n // 2:
		print(a)
		print(*[0 for _ in range(a)])
	else:
		print(a - a % 2)
		print(*[0 for _ in range(a - a % 2)])


for _ in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	z = x.count(0)
	o = n - z
	if z >= n // 2:
		print(z)
		print('0 ' * z)
	else:
		print(o - o % 2)
		print('1 ' * (o - o % 2))


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	cnt1 = a.count(1)
	cnt0 = a.count(0)
	if cnt0 >= cnt1:
		print(cnt0)
		res = [0] * cnt0
		print(*res)
	elif cnt1 % 2 == 0:
		print(cnt1)
		res = [1] * cnt1
		print(*res)
	else:
		print(cnt1 - 1)
		res = [1] * (cnt1 - 1)
		print(*res)


import sys
input = sys.stdin.readline
for test in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	zeros = a.count(0)
	ones = a.count(1)
	if zeros >= n // 2:
		a = [0] * zeros
	else:
		a = [1] * (2 * (ones // 2))
	print(len(a))
	print(*a)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	c0 = arr.count(0)
	c1 = arr.count(1)
	if c0 < c1:
		if (n - min(c0, c1)) % 2:
			l = n - min(c0, c1) - 1
			arr = [1] * (n - min(c0, c1) - 1)
		else:
			l = n - min(c0, c1)
			arr = [1] * (n - min(c0, c1))
	else:
		arr = [0] * (n - min(c0, c1))
		l = n - min(c0, c1)
	print(l)
	print(*arr, sep=' ')


import sys
import math
from decimal import *

def I():
	return int(sys.stdin.readline())

def IL():
	return list(map(int, sys.stdin.readline().strip().split()))

def ILS():
	return list(map(str, sys.stdin.readline().strip().split()))

def solve():
	tt = I()
	for ii in range(tt):
		n = I()
		l = IL()
		ev = 0
		for ll in l:
			if ll == 0:
				ev += 1
		res = None
		ans = None
		if ev >= n // 2:
			res = ev
			ans = 0
		else:
			res = n - ev
			ans = 1
		if res == n // 2 and res % 2 == 1 and (ans == 1):
			print(n // 2)
			for p in range(n // 2):
				print(0, end=' ')
			print()
		else:
			if res % 2 == 1 and res != n // 2:
				res -= 1
			print(res)
			for i in range(res):
				print(ans, end=' ')
			print()
			pass
solve()


t = int(input())
for test in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	count_1 = a.count(1)
	if count_1 <= n / 2:
		a_ = [num for num in a if num == 0]
	else:
		a_ = [num for num in a if num == 1]
		if len(a_) % 2 != 0:
			del a_[0]
	print(len(a_))
	print(*a_)


t = int(input())
while t:
	t += -1
	n = int(input())
	l = list(map(int, input().split()))
	(c0, c1) = (0, 0)
	for i in l:
		if i:
			c1 -= -1
		else:
			c0 -= -1
	if c1 > c0:
		if c1 % 2:
			c1 += -1
		print(c1, '1 ' * c1, sep='\n')
	else:
		print(c0, '0 ' * c0, sep='\n')


t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	s0 = 0
	s1 = 0
	for x in a:
		if x == 0:
			s0 += 1
		else:
			s1 += 1
	b = []
	if s1 <= n // 2:
		for x in a:
			if x != 1:
				b.append(x)
	elif s0 < n // 2:
		for x in a:
			if x != 0:
				b.append(x)
		if len(b) % 2 != 0:
			del b[0]
	else:
		b = a
	print(len(b))
	for x in b:
		print(x, end=' ')
	print()
	t -= 1


for ad in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	if l.count(1) <= n // 2:
		x = l.count(0)
		ans = '0' * x
	elif n % 4 == 0:
		x = n // 2
		ans = '1' * (n // 2)
	else:
		x = n // 2 + 1
		ans = '1' * (n // 2 + 1)
	print(x)
	ans = list(ans)
	for i in ans:
		print(i, end=' ')
	print()


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	z = 0
	o = 0
	k = []
	for i in a:
		if i == 0:
			z += 1
		else:
			o += 1
	if o <= n // 2 and o <= z:
		for i in a:
			if i == 0:
				k.append(i)
	elif z <= n // 2 and z < o:
		for i in a:
			if i == 1:
				k.append(i)
		if len(k) % 2 != 0 and len(k) > 1:
			k.remove(k[len(k) - 1])
	print(len(k))
	for i in k:
		print(i, end=' ')
	print()


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	one = zero = 0
	for e in a:
		if e == 1:
			one += 1
		else:
			zero += 1
	if one > zero:
		if one % 2 == 1:
			print(n - zero - 1)
			print('1 ' * (n - zero - 1))
		else:
			print(n - zero)
			print('1 ' * (n - zero))
	else:
		print(n - one)
		print('0 ' * (n - one))


from __future__ import division, print_function
import os, sys
import math
import collections
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

class my_dictionary(dict):

	def __init__(self):
		self = dict()

	def add(self, key, value):
		self[key] = value

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def sli():
	return list(msi())

def dmain():
	sys.setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def factorial(n):
	return 1 if n == 1 or n == 0 else n * factorial(n - 1)

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(n - r))

def binary_search(arr, low, high, x):
	if high >= low:
		mid = (high + low) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] > x:
			return binary_search(arr, low, mid - 1, x)
		else:
			return binary_search(arr, mid + 1, high, x)
	else:
		return -1

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def nCr(n, r):
	return fact(n) / (fact(r) * fact(n - r))

def fact(n):
	res = 1
	for i in range(2, n + 1):
		res = res * i
	return res

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def padded_bin_with_complement(x):
	if x < 0:
		return bin(2 ** 16 - abs(x))[2:].zfill(16)
	else:
		return bin(x)[2:].zfill(16)

def binaryToDecimal(binary):
	binary1 = binary
	(decimal, i, n) = (0, 0, 0)
	while binary != 0:
		dec = binary % 10
		decimal = decimal + dec * pow(2, i)
		binary = binary // 10
		i += 1
	print(decimal)

def CountFrequency(my_list):
	freq = {}
	for item in my_list:
		if item in freq:
			freq[item] += 1
		else:
			freq[item] = 1
	return freq

def pos(a):
	b = [0] * len(a)
	c = sorted(a)
	for i in range(len(a)):
		for j in range(len(a)):
			if c[j] == a[i]:
				b[i] = j
				break
	return b

def smallestDivisor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i * i <= n:
		if n % i == 0:
			return i
		i += 2
	return n

def commonn(a, b, n):
	c = []
	for i in range(n):
		if a[i] == b[i]:
			c.append('-1')
		else:
			c.append(b[i])
	return c

def find_lcm(num1, num2):
	if num1 > num2:
		num = num1
		den = num2
	else:
		num = num2
		den = num1
	rem = num % den
	while rem != 0:
		num = den
		den = rem
		rem = num % den
	gcd = den
	lcm = int(int(num1 * num2) / int(gcd))
	return lcm

def sumdigit(n):
	n = str(n)
	k = 0
	for i in range(len(n)):
		k += int(n[i])
	return k

def main():
	for _ in range(ii()):
		n = ii()
		a = li()
		if a.count(0) >= a.count(1):
			print(a.count(0))
			for i in range(a.count(0)):
				print(0, end=' ')
			print()
		elif a.count(1) % 2:
			print(a.count(1) - 1)
			for i in range(a.count(1) - 1):
				print(1, end=' ')
			print()
		else:
			print(a.count(1))
			for i in range(a.count(1)):
				print(1, end=' ')
			print()
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys, os.path
import math
from collections import Counter
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def solve(l, n):
	x = Counter(l)
	if x[0] >= x[1]:
		print(x[0])
		print(' '.join('0' * x[0]))
	elif x[1] % 2 == 0:
		print(x[1])
		print(' '.join('1' * x[1]))
	else:
		print(x[1] - 1)
		print(' '.join('1' * (x[1] - 1)))
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	solve(l, n)


for _ in range(int(input())):
	n = int(input())
	s = input().split()
	l = [0, 0]
	for i in range(n):
		if int(s[i]):
			l[0] = l[0] + int(s[i])
		else:
			l[1] = l[1] + int(s[i])
	if l[0] > n // 2:
		if l[0] % 2 != 0:
			l[0] = l[0] - 1
		print(l[0])
		print(*l[0] * '1')
	else:
		print(n - l[0])
		print(*'0' * (n - l[0]))


for tt in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	poss = []
	(i, j) = (0, 0)
	if l.count(1) == l.count(0):
		ans = []
		for i in l:
			if i == 0:
				ans.append(i)
		print(len(l) - len(ans))
		print(*ans)
	elif l.count(1) > l.count(0):
		ans = []
		for i in l:
			if i == 1:
				ans.append(i)
		if len(ans) % 2 != 0:
			ans.pop()
			print(len(ans))
			print(*ans)
		else:
			print(len(ans))
			print(*ans)
	else:
		ans = []
		for i in l:
			if i == 0:
				ans.append(i)
		if len(ans) % 2 != 0:
			ans.pop()
			print(len(ans))
			print(*ans)
		else:
			print(len(ans))
			print(*ans)


for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	c = 0
	for i in range(n):
		if ar[i] == 1:
			c += 1
	if c <= n // 2:
		print(n - c)
		print(*[0 for i in range(n - c)])
	elif c % 2:
		print(c - 1)
		print(*[1 for i in range(c - 1)])
	else:
		print(c)
		print(*[1 for i in range(c)])


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	l = a.count(0)
	if l >= n // 2:
		print(l)
		print('0 ' * l)
	else:
		y = n - l
		if y % 2 == 0:
			print(y)
			print('1 ' * y)
		else:
			print(y - 1)
			print('1 ' * (y - 1))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(count, cnt) = (a.count(1), a.count(0))
	if count == cnt:
		print(n // 2)
		lst = [0] * (n // 2)
		print(*lst, sep=' ')
	elif count > cnt:
		if count % 2 == 0:
			lst = [1] * count
			print(len(lst))
			print(*lst, sep=' ')
		else:
			lst = [1] * (count - 1)
			print(len(lst))
			print(*lst, sep=' ')
	elif cnt % 2 == 0:
		lst = [0] * cnt
		print(len(lst))
		print(*lst, sep=' ')
	else:
		lst = [0] * (cnt - 1)
		print(len(lst))
		print(*lst, sep=' ')


from functools import reduce
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def arr():
	return [int(i) for i in input().split()]

def sarr():
	return [int(i) for i in input()]

def starr():
	return [str(x) for x in input().split()]

def inn():
	return int(input())

def svalue():
	return tuple(map(str, input().split()))

def parr():
	return [value() for i in range(n)]
mo = 1000000007
for _ in range(inn()):
	n = inn()
	a = arr()
	if len(set(a)) == 1:
		print(n)
		print(*a)
	elif a.count(0) >= n // 2:
		ans = [0] * (n // 2)
		print(n // 2)
		print(*ans)
	else:
		res = n // 2
		if res % 2 == 0:
			ans = [1] * (n // 2)
		else:
			ans = [1] * (n // 2 + 1)
		print(len(ans))
		print(*ans)


import sys
input = sys.stdin.buffer.readline
for _ in range(int(input())):
	N = int(input())
	a = list(map(int, input().split()))
	x = a.count(0)
	y = N - x
	if x >= N // 2:
		print(x)
		print(*[0] * x)
	elif y % 2:
		print(y - y % 2)
		print(*[1] * (y - y % 2))
	else:
		print(y)
		print(*[1] * y)


t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	zero = a.count(0)
	one = n - zero
	if one > zero:
		one = 2 * (one // 2)
		print(one)
		for x in range(one):
			print('1', end=' ')
	else:
		print(zero)
		for x in range(zero):
			print('0', end=' ')
	print()
	t -= 1


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
for _ in range(int(inp())):
	n = int(inp())
	arr = lmp()
	z = arr.count(0)
	o = arr.count(1)
	if z >= o:
		print(z)
		print(*[0 for i in range(z)])
	else:
		o = 2 * (o // 2)
		print(o)
		print(*[1 for i in range(o)])


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	s0 = arr.count(0)
	s1 = arr.count(1)
	if s1 <= n // 2:
		arr = [i for i in arr if i != 1]
	else:
		arr = [i for i in arr if i != 0]
		if s1 % 2 != 0:
			arr.remove(1)
	print(len(arr))
	for i in arr:
		print(i, end=' ')
	print('\n')


for T in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	z = l.count(1)
	if z <= n // 2:
		print(n - z)
		print('0 ' * (n - z))
	elif z > n // 2:
		if z % 2 == 0:
			print(z)
			print('1 ' * z)
		else:
			print(z - 1)
			print('1 ' * (z - 1))


def op():
	n = int(input())
	arr = list(map(int, input().split()))
	one = arr.count(1)
	zero = n - one
	if zero >= n // 2:
		print(zero)
		for i in range(zero):
			print('0 ', end='')
	else:
		print(one - one % 2)
		for i in range(one - one % 2):
			print('1 ', end='')
t = int(input())
while t > 0:
	t = t - 1
	op()
	print()


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		nums = [int(x) for x in input().split()]
		cnt0 = nums.count(0)
		cnt1 = nums.count(1)
		if cnt1 <= n // 2:
			for k in range(cnt1):
				nums.remove(1)
		else:
			for k in range(cnt0):
				nums.remove(0)
			if cnt1 % 2 == 1:
				nums.remove(1)
		print(len(nums))
		for num in nums:
			print(num, end=' ')
main()


t = int(input())
for _ in range(t):
	n = int(input())
	a = input()
	ones = a.count('1')
	if ones <= n // 2:
		print(n - ones)
		print(' '.join(['0'] * (n - ones)))
	else:
		zz = ones // 2 * 2
		print(zz)
		print(' '.join(['1'] * zz))


t = int(input())
for _ in range(t):
	n = int(input())
	a = input().split()
	cnt1 = a.count('1')
	cnt0 = n - cnt1
	if cnt0 >= cnt1:
		print(cnt0)
		print(('0 ' * cnt0).strip())
	elif cnt1 % 2 == 0:
		print(cnt1)
		print(('1 ' * cnt1).strip())
	else:
		print(cnt1 - 1)
		print(('1 ' * (cnt1 - 1)).strip())


ans = []
for x in range(int(input())):
	res = []
	waste = int(input())
	l = list(map(int, input().split()))
	a = l.count(1)
	b = l.count(0)
	if a > b:
		if a % 2 == 0:
			for y in range(a):
				c = 1
				dd = str(c)
				res.append(dd)
			sep = ' '
			de = sep.join(res)
			ans.append(len(res))
			ans.append(de)
		else:
			d = a - 1
			for y in range(d):
				c = 1
				dd = str(c)
				res.append(dd)
			sep = ' '
			de = sep.join(res)
			ans.append(len(res))
			ans.append(de)
	elif a == b:
		for y in range(a):
			c = 0
			dd = str(c)
			res.append(dd)
		sep = ' '
		de = sep.join(res)
		ans.append(len(res))
		ans.append(de)
	elif b > a:
		for y in range(b):
			c = 0
			dd = str(c)
			res.append(dd)
		sep = ' '
		de = sep.join(res)
		ans.append(len(res))
		ans.append(de)
for x1 in ans:
	print(x1)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	x = l.count(1)
	y = l.count(0)
	if x <= y:
		print(y)
		for j in range(y):
			print('0', end=' ')
		print()
	else:
		x = x if x % 2 == 0 else x - 1
		print(x)
		for j in range(x):
			print('1', end=' ')
		print()


import sys
import math
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	one = 0
	zer = 0
	for j in a:
		if j == 1:
			one += 1
		else:
			zer += 1
	if one <= n // 2:
		print(zer)
		for j in range(zer):
			print(0, end=' ')
	else:
		if zer % 2 == 1 and n != 2:
			one -= 1
		print(one)
		for j in range(one):
			print(1, end=' ')
	print('')


t = int(input())
for i in range(0, t):
	m = int(input())
	arr = list(map(int, input().strip().split()))
	zc = arr.count(0)
	oc = arr.count(1)
	l1 = []
	if zc >= oc:
		for j in range(0, zc):
			l1.append(0)
	elif oc % 2 == 0:
		for j in range(0, oc):
			l1.append(1)
	else:
		for j in range(0, oc - 1):
			l1.append(1)
	y = len(l1)
	print(y)
	print(*l1, sep=' ')


from math import *
from bisect import *
from collections import *
from random import *
from decimal import *

def inp():
	return int(input())

def st():
	return input().rstrip('\n')

def lis():
	return list(map(int, input().split()))

def ma():
	return map(int, input().split())
t = inp()
while t:
	t -= 1
	n = inp()
	a = lis()
	o = a.count(1)
	z = n - o
	if o == n:
		print(n)
		print(*[1] * n)
	elif z == n:
		print(n)
		print(*[0] * n)
	elif z >= n // 2:
		print(z)
		print(*[0] * z)
	elif o >= n // 2 and o % 2 == 0:
		print(o)
		print(*[1] * o)
	else:
		print(o - 1)
		print(*[1] * (o - 1))


def mi():
	return map(int, input().split())
for _ in range(int(input())):
	n = int(input())
	a = list(mi())
	(o, z) = (0, 0)
	for i in range(n):
		if a[i]:
			o += 1
		else:
			z += 1
	if o <= n // 2:
		print(z)
		print('0 ' * z)
	else:
		o -= o % 2
		print(o)
		print('1 ' * o)


t = int(input(''))
arr = []
for i in range(t):
	n = int(input(''))
	arr.append(list(map(int, input().split())))
for i in arr:
	n = len(i)
	cnt0 = i.count(0)
	cnt1 = i.count(1)
	if cnt0 >= cnt1:
		print(cnt0)
		sol = [0] * cnt0
		print(*sol)
	else:
		c = cnt1
		if c % 2 == 0:
			print(c)
			sol = [1] * c
			print(*sol)
		else:
			print(c - 1)
			sol = [1] * (c - 1)
			print(*sol)


from collections import Counter
import math
t = int(input())
for some_num in range(t):
	n = int(input())
	k = [int(i) for i in input().split(' ')]
	kc = Counter(k)
	if kc[0] >= n / 2:
		print(kc[0])
		print('0 ' * kc[0])
	else:
		a = kc[1] // 2 * 2
		print(a)
		print('1 ' * a)


from sys import stdin
inp = lambda : stdin.readline().strip()
t = int(inp())
for _ in range(t):
	n = int(inp())
	a = [int(x) for x in inp().split()]
	zero = a.count(0)
	ones = a.count(1)
	if zero < ones:
		ans = []
		for i in a:
			if i == 1:
				ans.append(i)
		if ones % 2:
			ans.pop()
		print(len(ans))
		print(*ans)
	else:
		print(zero)
		print(*[0] * zero)


t = int(input())
for _ in range(t):
	n = int(input())
	l1 = list(map(int, input().split()))
	s0 = l1.count(0)
	s1 = l1.count(1)
	if s0 % 2 == 0 and s1 % 2 == 0:
		m = max(s0, s1)
		print(m)
		if m == s0:
			for i in range(m - 1):
				print(0, end=' ')
			print(0)
		else:
			for i in range(m - 1):
				print(1, end=' ')
			print(1)
	elif s0 % 2 != 0 and s1 % 2 != 0:
		if s0 == s1:
			print(s0)
			for i in range(s0 - 1):
				print(0, end=' ')
			print(0)
		else:
			m = max(s0, s1)
			print(m - 1)
			if m == s0:
				for i in range(m - 2):
					print(0, end=' ')
				print(0)
			else:
				for i in range(m - 2):
					print(1, end=' ')
				print(1)


for _ in range(int(input())):
	n = int(input())
	(o, z) = (0, 0)
	for i in input().split():
		t = int(i)
		if t == 0:
			z += 1
		if t == 1:
			o += 1
	ans = [0] * z if z >= o else [1] * o
	if ans[0] == 1 and len(ans) % 2 == 1:
		ans.pop()
	print(len(ans))
	print(*ans)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	o = l.count(1)
	z = l.count(0)
	e = n // 2
	if o == 0:
		print(n)
		print(*l)
		continue
	if o <= e:
		print(n - o)
		m = [0] * (n - o)
		print(*m)
		continue
	if o % 2 == 0 and z <= e:
		print(o)
		m = [1] * (n - z)
		print(*m)
		continue
	if o % 2 == 1 and z <= e:
		print(o - 1)
		m = [1] * (n - z - 1)
		print(*m)
		continue


t = int(input())
for z in range(t):
	n = int(input())
	arr = [int(inp) for inp in input().split()]
	cnt1 = cnt0 = 0
	for num in arr:
		if num == 1:
			cnt1 += 1
		else:
			cnt0 += 1
	ans = ''
	if cnt1 <= n / 2:
		for x in range(cnt0):
			ans += '0 '
		ans = str(cnt0) + '\n' + ans
		print(ans)
		continue
	if cnt1 % 2 == 0:
		ans = str(cnt1) + '\n' + ans
		for x in range(cnt1):
			ans += '1 '
	else:
		ans = str(cnt1 - 1) + '\n' + ans
		for x in range(cnt1 - 1):
			ans += '1 '
	print(ans)


test = int(input())
for _ in range(test):
	n = int(input())
	a = list(map(int, input().split()))
	o = a.count(1)
	z = a.count(0)
	if z >= n // 2:
		print(z)
		for i in range(n):
			if a[i] == 0:
				print(0, end=' ')
	else:
		if o % 2 != 0:
			o -= 1
		print(o)
		count = 0
		for i in range(n):
			if a[i] == 1:
				print(1, end=' ')
				count += 1
				if count == o:
					break
	print('')


for T in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	N1 = a.count(1)
	N0 = n - N1
	if N0 >= n // 2:
		print(N0, N0 * '0 ', sep='\n')
	else:
		N1 -= N1 & 1
		print(N1, N1 * '1 ', sep='\n')


t = int(input())
for case in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	nz = 0
	no = 0
	for i in arr:
		if i == 0:
			nz += 1
		else:
			no += 1
	ans = []
	if nz >= no:
		ans = ['0'] * nz
	else:
		ans = ['1'] * no
	if no > nz and no % 2 == 1:
		ans.pop()
	print(len(ans))
	print(' '.join(ans))


from sys import stdin
from collections import Counter
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	count = Counter(a)
	if count[0] < count[1]:
		res = count[1] - count[1] % 2
		print(res)
		print('1 ' * res)
	else:
		res = count[0]
		print(res)
		print('0 ' * res)


t = int(input())
for _ in range(t):
	n = int(input())
	L = list(map(int, input().split()))
	a = b = 0
	for i in L:
		if i == 0:
			a = a + 1
		else:
			b = b + 1
	if a == 1 and b == 1:
		print(1)
		print(0, end=' ')
	elif a >= b:
		print(a)
		for i in range(a):
			print(0, end=' ')
	else:
		print(b - b % 2)
		for i in range(b - b % 2):
			print(1, end=' ')
	print()


t = int(input())
i = 0
while i < t:
	n = int(input())
	a = list(map(int, input().split()))
	b = []
	zero = a.count(0)
	IND = []
	index = 0
	if zero >= n // 2:
		while index < n:
			if a[index] == 1:
				IND.append(index)
			index += 1
		index = 0
		while index < n:
			if index not in IND:
				b.append(a[index])
			index += 1
	else:
		while index < n:
			if a[index] == 0:
				IND.append(index)
			index += 1
		index = 0
		while index < n:
			if index not in IND:
				b.append(a[index])
			index += 1
		L = len(a) - len(IND)
		if L % 2 == 1:
			del b[0]
	print(len(b))
	B = ''
	for j in b:
		B += str(j) + ' '
	print(B)
	i += 1


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	seq = list(map(int, input().split()))
	countOne = seq.count(1)
	countZero = seq.count(0)
	sumEven = sumOdd = 0
	for i in range(n):
		if i % 2 == 0:
			sumEven += seq[i]
		else:
			sumOdd += seq[i]
	if countOne <= countZero:
		ans.append(countZero)
		ans.append([0] * countZero)
	else:
		if countOne % 2 == 1:
			countOne -= 1
		ans.append(countOne)
		ans.append([1] * countOne)
for el in ans:
	if type(el) == list:
		print(*el)
	else:
		print(el)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	one = 0
	zero = 0
	for i in ar:
		if i == 0:
			zero += 1
		else:
			one += 1
	if n == 2:
		if zero == one:
			print(1)
			print(0)
		elif zero != 0:
			print(2)
			print(0, 0)
		else:
			print(2)
			print(1, 1)
	elif zero >= one:
		print(n // 2)
		print('0 ' * (n // 2))
	elif n % 4 == 0:
		print(n // 2)
		print('1 ' * (n // 2))
	else:
		print(n // 2 + 1)
		print('1 ' * (n // 2 + 1))


for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	c0 = 0
	c1 = 0
	for i in range(n):
		if l[i] == 1:
			c1 += 1
		else:
			c0 += 1
	if c0 >= c1:
		print(c0)
		print(*[0] * c0)
	else:
		if c1 % 2 != 0:
			c1 -= 1
		print(c1)
		print(*[1] * c1)


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
import sys
letters = ascii_letters
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	z = arr.count(0)
	o = arr.count(1) // 2 * 2
	if z >= o:
		print(z)
		print(*[0] * z)
	else:
		print(o)
		print(*[1] * o)


t = int(input())
for _ in range(t):
	n = int(input())
	s = list(map(int, input().split()))
	x = s.count(0)
	y = s.count(1)
	if y % 2 != 0:
		s.remove(1)
		y -= 1
		x += 1
		y += 1
	if x < y:
		print(n - x)
		for i in s:
			if i == 1:
				print(i, end=' ')
	else:
		print(n - y)
		for i in s:
			if i == 0:
				print(i, end=' ')
	print()


from sys import stdin

class Input:

	def readline(self):
		return stdin.readline().strip()

	def read_list(self):
		return self.readline().split()

	def read_ints(self):
		return list(map(int, self.read_list()))

	def known_tests(self):
		cases = self.read_ints()[0]
		for case in range(cases):
			yield self

	def single_test(self):
		yield self

class Problem:

	def __init__(self, input):
		(n,) = input.read_ints()
		a = input.read_ints()
		c = [0, 0]
		for i in a:
			c[i] += 1
		if c[0] == 0 or c[1] == 0:
			pass
		elif c[0] == c[1]:
			while 1 in a:
				a.remove(1)
		elif c[0] < c[1]:
			while 0 in a:
				a.remove(0)
			if len(a) % 2 == 1:
				a.remove(1)
		else:
			while 1 in a:
				a.remove(1)
		print(len(a))
		print(*tuple(a))
for test_input in Input().known_tests():
	Problem(test_input)


for _ in range(int(input())):
	n = int(input())
	b = [n - sum(list(map(int, input().split())))]
	b.append(n - b[0])
	i = 1 if b[1] * 2 > n else 0
	k = b[i] - b[i] % 2 * i
	print(k)
	print(*[i] * k)


from collections import Counter
cases = int(input())
for t in range(cases):
	n = int(input())
	a = list(map(int, input().split()))
	a = Counter(a)
	if a[0] >= a[1]:
		print(a[0])
		print(*[0] * a[0])
	elif a[1] % 2 == 0:
		print(a[1])
		print(*[1] * a[1])
	else:
		print(a[1] - 1)
		print(*[1] * (a[1] - 1))


from __future__ import division, print_function
import math
import os
import sys
from fractions import *
from sys import *
from decimal import *
from io import BytesIO, IOBase
from itertools import *
from collections import *
M = 10 ** 9 + 7
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def fsep():
	return map(float, inp().split())

def inpu():
	return int(inp())

def regularbracket(t):
	p = 0
	for i in t:
		if i == '(':
			p += 1
		else:
			p -= 1
		if p < 0:
			return False
	else:
		if p > 0:
			return False
		else:
			return True

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def reverse1(string):
	pp = ''
	for i in string[::-1]:
		pp += i
	if pp == string:
		return True
	return False

def reverse2(list1):
	l = []
	for i in list1[::-1]:
		l.append(i)
	if l == list1:
		return True
	return False

def mex(list1):
	p = max(list1) + 1
	for i in range(len(list1)):
		if list1[i] != i:
			p = i
			break
	return p

def sumofdigits(n):
	n = str(n)
	s1 = 0
	for i in n:
		s1 += int(i)
	return s1

def perfect_square(n):
	s = math.sqrt(n)
	if s == int(s):
		return True
	return False

def roman_number(x):
	if x > 15999:
		return
	value = [5000, 4000, 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]
	symbol = ['F', 'MF', 'M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I']
	roman = ''
	i = 0
	while x > 0:
		div = x // value[i]
		x = x % value[i]
		while div:
			roman += symbol[i]
			div -= 1
		i += 1
	return roman

def soretd(s):
	for i in range(1, len(s)):
		if s[i - 1] > s[i]:
			return False
	return True

def countRhombi(h, w):
	ct = 0
	for i in range(2, h + 1, 2):
		for j in range(2, w + 1, 2):
			ct += (h - i + 1) * (w - j + 1)
	return ct

def countrhombi2(h, w):
	return h * h // 4 * (w * w // 4)

def binpow(a, b):
	if b == 0:
		return 1
	else:
		res = binpow(a, b // 2)
	if b % 2 != 0:
		return res * res * a
	else:
		return res * res

def binpowmodulus(a, b, m):
	a %= m
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % m
		a = a * a % m
		b >>= 1
	return res

def coprime_to_n(n):
	result = n
	i = 2
	while i * i <= n:
		if n % i == 0:
			while n % i == 0:
				n //= i
			result -= result // i
		i += 1
	if n > 1:
		result -= result // n
	return result

def prime(x):
	if x == 1:
		return False
	else:
		for i in range(2, int(math.sqrt(x)) + 1):
			if x % i == 0:
				return False
		else:
			return True

def luckynumwithequalnumberoffourandseven(x, n, a):
	if x >= n and str(x).count('4') == str(x).count('7'):
		a.append(x)
	elif x < 1000000000000.0:
		luckynumwithequalnumberoffourandseven(x * 10 + 4, n, a)
		luckynumwithequalnumberoffourandseven(x * 10 + 7, n, a)
	return a

def luckynum(x, l, r, a):
	if x >= l and x <= r:
		a.append(x)
	if x > r:
		a.append(x)
		return a
	if x < 10000000000.0:
		luckynum(x * 10 + 4, l, r, a)
		luckynum(x * 10 + 7, l, r, a)
	return a

def luckynuber(x, n, a):
	p = set(str(x))
	if len(p) <= 2:
		a.append(x)
	if x < n:
		luckynuber(x + 1, n, a)
	return a

def interact(type, x):
	if type == 'r':
		inp = input()
		return inp.strip()
	else:
		print(x, flush=True)

def findTrailingZeros(n):
	count = 0
	while n >= 5:
		n //= 5
		count += n
	return count

def mergeSort(arr):
	if len(arr) > 1:
		mid = len(arr) // 2
		L = arr[:mid]
		R = arr[mid:]
		mergeSort(L)
		mergeSort(R)
		i = j = k = 0
		while i < len(L) and j < len(R):
			if L[i] < R[j]:
				arr[k] = L[i]
				i += 1
			else:
				arr[k] = R[j]
				j += 1
			k += 1
		while i < len(L):
			arr[k] = L[i]
			i += 1
			k += 1
		while j < len(R):
			arr[k] = R[j]
			j += 1
			k += 1
res = set()

def solven(p, l, a, b, n):
	if p > n or l > 10:
		return
	if p > 0:
		res.add(p)
	solven(p * 10 + a, l + 1, a, b, n)
	solven(p * 10 + b, l + 1, a, b, n)

def subsetsUtil(A, subset, index, d):
	print(*subset)
	s = sum(subset)
	d.append(s)
	for i in range(index, len(A)):
		subset.append(A[i])
		subsetsUtil(A, subset, i + 1, d)
		subset.pop(-1)
	return d

def subsetSums(arr, l, r, d, sum=0):
	if l > r:
		d.append(sum)
		return
	subsetSums(arr, l + 1, r, d, sum + arr[l])
	subsetSums(arr, l + 1, r, d, sum)
	return d

def print_factors(x):
	factors = []
	for i in range(1, x + 1):
		if x % i == 0:
			factors.append(i)
	return factors

def calc(X, d, ans, D):
	if len(X) == 0:
		return
	i = X.index(max(X))
	ans[D[max(X)]] = d
	Y = X[:i]
	Z = X[i + 1:]
	calc(Y, d + 1, ans, D)
	calc(Z, d + 1, ans, D)

def factorization(n, l):
	c = n
	if prime(n) == True:
		l.append(n)
		return l
	for i in range(2, c):
		if n == 1:
			break
		while n % i == 0:
			l.append(i)
			n = n // i
	return l

def good(b):
	l = []
	i = 0
	while len(b) != 0:
		if b[i] < b[len(b) - 1 - i]:
			l.append(b[i])
			b.remove(b[i])
		else:
			l.append(b[len(b) - 1 - i])
			b.remove(b[len(b) - 1 - i])
	if l == sorted(l):
		return True
	return False

def generate(st, s):
	if len(s) == 0:
		return
	if s not in st:
		st.add(s)
		for i in range(len(s)):
			t = list(s).copy()
			t.remove(s[i])
			t = ''.join(t)
			generate(st, t)
	return

def largestincreasingsubsequence(A):
	l = [1] * len(A)
	sub = []
	for i in range(1, len(l)):
		for k in range(i):
			if A[k] < A[i]:
				sub.append(l[k])
		l[i] = 1 + max(sub, default=0)
	return max(l, default=0)

def findOR(nums, N):
	prefix_sum = 0
	result = 0
	for i in range(N):
		result |= nums[i]
		prefix_sum += nums[i]
		result |= prefix_sum
	return result

def OR(a, n):
	ans = a[0]
	for i in range(1, n):
		ans |= a[i]
	return ans

def toString(List):
	return ''.join(List)
p = []

def permute(a, l, r):
	if l == r:
		p.append(toString(a))
	else:
		for i in range(l, r + 1):
			(a[l], a[i]) = (a[i], a[l])
			permute(a, l + 1, r)
			(a[l], a[i]) = (a[i], a[l])

def squareRoot(number, precision):
	start = 0
	(end, ans) = (number, 1)
	while start <= end:
		mid = int((start + end) / 2)
		if mid * mid == number:
			ans = mid
			break
		if mid * mid < number:
			start = mid + 1
		else:
			end = mid - 1
	increment = 0.1
	for i in range(0, precision):
		while ans * ans <= number:
			ans += increment
		ans = ans - increment
		increment = increment / 10
	return ans
import math

def countRectangles(l, w):
	squareSide = math.gcd(l, w)
	return int(l * w / (squareSide * squareSide))

def count_same_digit(L, R):
	tmp = 0
	ans = 0
	n = int(math.log10(R) + 1)
	for i in range(0, n):
		tmp = tmp * 10 + 1
		for j in range(1, 10):
			if L <= tmp * j and tmp * j <= R:
				ans += 1
	return ans

def main():
	for _ in range(inpu()):
		n = inpu()
		arr = lis()
		one = arr.count(1)
		zero = arr.count(0)
		if one > zero:
			if one % 2 == 0:
				print(one)
				for _ in range(one):
					print(1, end=' ')
				print()
			else:
				print(one - 1)
				for _ in range(one - 1):
					print(1, end=' ')
				print()
		elif zero > one:
			if zero % 2 == 0:
				print(zero)
				for _ in range(zero):
					print(0, end=' ')
				print()
			else:
				print(zero - 1)
				for _ in range(zero - 1):
					print(0, end=' ')
				print()
		elif one % 2 == 0:
			print(one)
			for _ in range(one):
				print(0, end=' ')
		else:
			x = arr.count(0)
			if x >= n // 2:
				out = [0] * x
			else:
				out = [1] * ((n - x) // 2) * 2
			print(len(out))
			print(*out)
main()


for ctr in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(z, o) = (a.count(0), a.count(1))
	if z >= n // 2:
		print(z)
		for i in range(z):
			print(0, end=' ')
		print()
	else:
		print(o - o % 2)
		for i in range(o - o % 2):
			print(1, end=' ')
		print()


t = input()
t = int(t)

def solve(n, arr):
	n1 = 0
	n0 = 0
	for x in arr:
		if x == 0:
			n0 += 1
		else:
			n1 += 1
	if n0 >= n1:
		print(n0)
		ans = [0] * n0
	elif n1 % 2 == 1:
		print(n1 - 1)
		ans = [1] * (n1 - 1)
	else:
		print(n1)
		ans = [1] * n1
	print(*ans)
for i in range(t):
	n = input()
	n = int(n)
	arr = list(map(int, input().split()))
	solve(n, arr)


from __future__ import division, print_function
import bisect
import math
import heapq
import itertools
import sys
from collections import deque
from atexit import register
from collections import Counter
from functools import reduce
if sys.version_info[0] < 3:
	from io import BytesIO as stream
else:
	from io import StringIO as stream
if sys.version_info[0] < 3:

	class dict(dict):

		def items(self):
			return dict.iteritems(self)

		def keys(self):
			return dict.iterkeys(self)

		def values(self):
			return dict.itervalues(self)
	input = raw_input
	range = xrange
	filter = itertools.ifilter
	map = itertools.imap
	zip = itertools.izip

def sync_with_stdio(sync=True):
	global input, flush
	if sync:
		flush = sys.stdout.flush
	else:
		sys.stdin = stream(sys.stdin.read())
		input = lambda : sys.stdin.readline().rstrip('\r\n')
		sys.stdout = stream()
		register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
mod = 1000000007
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	z = a.count(0)
	one = n - z
	if one <= n / 2:
		print(z)
		for i in a:
			if i != 1:
				print(i, end=' ')
		print()
		continue
	if one % 2 == 0:
		print(one)
		for i in a:
			if i != 0:
				print(i, end=' ')
		print()
	else:
		print(one - 1)
		z = []
		for i in a:
			if i != 0:
				z.append(i)
		print(*z[1:])


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(p) for p in input().split()]
	ones = arr.count(1)
	zeros = arr.count(0)
	if zeros >= ones:
		if zeros % 2 == 0:
			print(zeros // 2 * 2)
			print(*[0] * (zeros // 2 * 2))
		else:
			print(zeros // 2 * 2 + 1)
			print(*[0] * (zeros // 2 * 2 + 1))
	else:
		print(ones // 2 * 2)
		print(*[1] * (ones // 2 * 2))


t = int(input())
for _ in range(t):
	n = int(input())
	array = list(map(int, input().split()))
	one = sum(array)
	zero = n - one
	x = 11
	if n == x:
		print(int(x / 2))
		print('10' * int(x / 2))
	if zero < one:
		if one % 2 == 0:
			print(one)
			ans = '1 ' * one
			print(ans[:-1])
		else:
			print(one - 1)
			ans = '1 ' * (one - 1)
			print(ans[:-1])
	else:
		print(zero)
		ans = '0 ' * zero
		print(ans[:-1])


import sys, math
input = lambda : sys.stdin.readline().rstrip()
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ans = []
	zir = 0
	f = 0
	for i in range(n):
		if a[i] == 0:
			zir += 1
		else:
			f += 1
	if zir >= n // 2:
		print(zir)
		for i in range(zir):
			print(0, end=' ')
	else:
		f -= f % 2
		print(f)
		cur = 0
		for i in range(f):
			print(1, end=' ')
	print()


t = int(input())
for i in range(t):
	n = int(input())
	a = input().replace(' ', '')
	cn = 0
	for i in a:
		if i == '1':
			cn += 1
	if cn <= n // 2:
		print(n - cn)
		for i in range(n - cn):
			print('0', end=' ')
	else:
		if cn % 2 != 0:
			cn -= 1
		print(cn)
		for i in range(cn):
			print('1', end=' ')
	print()


t = int(input())
while t > 0:
	n = int(input())
	arr = list(map(int, input().split()))
	count0 = arr.count(0)
	count1 = arr.count(1)
	if count0 >= n // 2:
		print(count0)
		for i in range(count0):
			print(0, end=' ')
	else:
		print(count1 - count1 % 2)
		for i in range(count1 - count1 % 2):
			print(1, end=' ')
	print()
	t = t - 1


for _ in range(int(input())):
	n = int(input())
	one = list(map(int, input().split()))
	one = len([x for x in one if x == 1])
	zero = n - one
	if zero >= n // 2:
		print(zero)
		print(*['0'] * zero)
	else:
		if one % 2 == 1:
			one -= 1
		print(one)
		print(*['1'] * one)


from sys import stdin, stdout
from math import gcd, log2, log10, floor
import math
from collections import defaultdict
input = stdin.readline

def count(a, i):
	return a.count(i)
for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	zeros = count(a, 0)
	ones = count(a, 1)
	if zeros >= ones:
		print(zeros)
		print(*[0] * zeros)
	else:
		if ones % 2 == 1:
			ones -= 1
		print(ones)
		print(*[1] * ones)


def pos(arr, n):
	evenP = []
	oddP = []
	for i in range(len(arr)):
		if i % 2 == 0 and arr[i] == 1:
			evenP.append(i)
		if i % 2 != 0 and arr[i] == 1:
			oddP.append(i)
	if n == 1:
		return oddP
	else:
		return evenP

def haha(arr):
	even = arr[0::2]
	odd = arr[1::2]
	n = len(arr) // 2
	i = n
	if arr.count(1) <= n:
		blanck = [0] * (len(arr) - arr.count(1))
		print(len(blanck))
		for i in blanck:
			print(i, end=' ')
		return ''
	if arr.count(0) < n:
		c = 0
		if arr.count(1) % 2 != 0:
			c = 1
		blanck = [1] * (len(arr) - arr.count(0) - c)
		print(len(blanck))
		for i in blanck:
			print(i, end=' ')
		return ''
	print(len(arr))
	for i in arr:
		print(i, end=' ')
	return ''
t = int(input())
for i in range(t):
	a = input()
	lst = list(map(int, input().strip().split()))
	print(haha(lst))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	oneCount = 0
	zeroCount = 0
	for elem in a:
		if elem == 1:
			oneCount += 1
		else:
			zeroCount += 1
	if zeroCount >= n // 2:
		print(zeroCount)
		print(' '.join(['0'] * zeroCount))
	else:
		print(oneCount // 2 * 2)
		print(' '.join(['1'] * (oneCount // 2 * 2)))


t = int(input())
for _ in range(t):
	n = int(input())
	cnt0 = 0
	a = []
	a = [int(i) for i in input().split()]
	for i in range(len(a)):
		if a[i] == 0:
			cnt0 += 1
	cnt1 = n - cnt0
	if cnt0 >= n / 2:
		print(cnt0)
		for i in range(cnt0):
			print(0)
	else:
		print(cnt1 - cnt1 % 2)
		for i in range(cnt1 - cnt1 % 2):
			print(1)


n = int(input())
for i in range(n):
	k = int(input())
	L1 = [int(i) for i in input().strip('\r').split(' ')]
	count_0 = 0
	count_1 = 0
	for i in range(len(L1)):
		if L1[i] == 1:
			count_1 += 1
		else:
			count_0 += 1
	if count_1 <= k // 2:
		result = ['0'] * count_0
	if count_0 < k // 2:
		result = ['1'] * count_1
		if count_0 % 2 != 0:
			result.pop()
	print(len(result))
	print(' '.join(result))


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(s) for s in input().split(' ')]
	zeroes = 0
	ones = 0
	output = ''
	for num in a:
		if num == 0:
			zeroes += 1
		else:
			ones += 1
	if zeroes >= n // 2:
		print(zeroes)
		print('0 ' * zeroes)
	else:
		print(ones - ones % 2)
		print('1 ' * (ones - ones % 2))


def even_spliter(arr):
	l = len(arr)
	gen = list()
	one = arr.count('1')
	zero = arr.count('0')
	if one > zero:
		for i in range(one):
			gen.append('1')
		if not one % 2 == 0:
			gen.pop()
	else:
		for i in range(zero):
			gen.append('0')
	return gen
t = input()
for i in range(int(t)):
	number = input()
	number = int(number)
	line = input()
	arr = line.split()
	gen = even_spliter(arr)
	str1 = ''
	for ele in gen:
		str1 = str1 + ' ' + ele
	print(len(gen))
	print(str1.strip())


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	suml = sum(l)
	if suml <= n / 2:
		print(n - suml)
		print(*[0 for _ in range(n - suml)])
	else:
		count = suml - suml % 2
		print(count)
		print(*[1 for _ in range(count)])


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import math
from collections import Counter, defaultdict, deque

def int1():
	return int(input())

def map1():
	return map(int, input().split())

def list1():
	return list(map(int, input().split()))
mod = pow(10, 9) + 7

def solve():
	n = int1()
	l1 = list1()
	c1 = l1.count(0)
	c2 = l1.count(1)
	if c1 >= c2:
		if 1:
			l1 = [0] * c1
			print(c1)
			print(*l1)
	elif c2 % 2 == 1:
		l1 = [1] * (c2 - 1)
		print(c2 - 1)
		print(*l1)
	else:
		l1 = [1] * c2
		print(c2)
		print(*l1)
for _ in range(int(input())):
	solve()


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	cnt0 = arr.count(0)
	cnt1 = arr.count(1)
	if cnt1 <= int(n / 2):
		print(n - cnt1)
		print(' '.join(['0'] * (n - cnt1)))
	elif cnt0 <= n / 2:
		if cnt1 % 2 == 1:
			print(cnt1 - 1)
			print(' '.join(['1'] * (cnt1 - 1)))
		else:
			print(cnt1)
			print(' '.join(['1'] * cnt1))


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	x0 = a.count(0)
	x1 = a.count(1)
	if x0 < n // 2:
		if x1 % 2 == 0:
			print(x1)
			print('1 ' * x1)
		else:
			print(x1 - 1)
			print('1 ' * (x1 - 1))
	else:
		print(x0)
		print('0 ' * x0)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	o = l.count(1)
	z = l.count(0)
	if o <= n // 2:
		print(z)
		print(*[0] * z)
	elif o % 2:
		print(o - 1)
		print(*[1] * (o - 1))
	else:
		print(o)
		print(*[1] * o)


def balanceArray(arr):
	l = len(arr)
	noZeroes = 0
	for i in arr:
		if i == 0:
			noZeroes += 1
	noOnes = l - noZeroes
	if noOnes <= l / 2:
		return [0] * noZeroes
	elif noOnes % 2 == 0:
		return [1] * noOnes
	else:
		return [1] * (noOnes - 1)
T = int(input())
for _ in range(T):
	N = int(input())
	arr = list(map(int, input().split()))
	res = balanceArray(arr)
	print(len(res))
	print(*res)


for tc in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	count1 = 0
	count2 = 0
	for x in lst:
		if x == 0:
			count2 += 1
		if x == 1:
			count1 += 1
	if count2 >= count1:
		print(count2)
		for i in range(count2):
			print(0, end=' ')
		print()
	elif count1 % 2 == 0:
		print(count1)
		for i in range(count1):
			print(1, end=' ')
		print()
	else:
		count1 = count1 - 1
		print(count1)
		for i in range(count1):
			print(1, end=' ')
		print()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(z, o) = (0, 0)
	for x in a:
		if x == 0:
			z += 1
		else:
			o += 1
	b = []
	if o > n // 2:
		b = [1] * (o - 1) if o & 1 else [1] * o
	else:
		b = [0] * z
	print(len(b))
	print(*b)


from collections import Counter
CASES = int(input())
for _ in range(CASES):
	n = int(input())
	dic = Counter(map(int, input().split()))
	n1 = dic[0]
	n2 = dic[1]
	if n2 > n1:
		if n2 % 2 == 0:
			print(n2)
			ans = [1 for i in range(n2)]
			print(*ans)
		else:
			print(n2 - 1)
			ans = [1 for i in range(n2 - 1)]
			print(*ans)
	else:
		print(n1)
		ans = [0 for i in range(n1)]
		print(*ans)


from sys import stdin, stdout

def input():
	a = stdin.readline()
	if a[-1] == '\n':
		a = a[:-1]
	return a

def print(*argv, end='\n', sep=' '):
	n = len(argv)
	for i in range(n):
		if i == n - 1:
			stdout.write(str(argv[i]))
		else:
			stdout.write(str(argv[i]) + sep)
	stdout.write(end)
mod = 10 ** 9 + 7

def lcm(x, y):
	return x * y / gcd(x, y)

def fact(x, mod=mod):
	ans = 1
	for i in range(1, x + 1):
		ans = ans * i % mod
	return ans

def arr2D(n, m, default=0):
	lst = []
	for i in range(n):
		temp = [default] * m
		lst.append(temp)
	return lst

def sortDictV(x):
	return {k: v for (k, v) in sorted(x.items(), key=lambda item: item[1])}

def solve(n, lst):
	z = 0
	for i in lst:
		if i == '0':
			z += 1
	o = n - z
	if z >= o:
		print(z)
		print('0 ' * z)
	else:
		o = 2 * (o // 2)
		print(o)
		print('1 ' * o)
for _ in range(int(input())):
	n = int(input())
	lst = ''.join(input().split())
	solve(n, lst)


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	count_one = a.count(1)
	count_zero = a.count(0)
	if count_zero >= count_one:
		print(count_zero)
		print('0 ' * count_zero)
	else:
		if count_one % 2 != 0:
			count_one -= 1
		print(count_one)
		print('1 ' * count_one)


def alternating_sum(n, seq):
	ones = len([x for x in seq if x == '1'])
	zeros = n - ones
	if zeros >= n // 2:
		return ['0'] * zeros
	elif ones % 2 == 0:
		return ['1'] * ones
	else:
		return ['1'] * (ones - 1)
t = int(input())
for x in range(t):
	n = int(input())
	seq = input().split()
	ans = alternating_sum(n, seq)
	print(len(ans), ' '.join(ans), sep='\n')


for __ in ' ' * int(input()):
	n = int(input())
	a = list(map(int, input().split()))
	cnt0 = a.count(0)
	cnt1 = a.count(1)
	if cnt0 >= cnt1:
		print(cnt0)
		print('0 ' * cnt0)
	else:
		print(cnt1 // 2 * 2)
		print('1 ' * (cnt1 // 2) * 2)


cases = int(input())
for _ in range(cases):
	n = int(input())
	c = list(map(int, input().split()))
	if c.count(1) <= n // 2:
		t = c.count(1)
		for i in range(t):
			c.remove(1)
		print(len(c))
		print(*c)
	else:
		t = c.count(0)
		for i in range(t):
			c.remove(0)
		if len(c) % 2 == 0:
			print(len(c))
			print(*c)
		else:
			c.remove(1)
			print(len(c))
			print(*c)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s0 = 0
	s1 = 0
	for i in range(n):
		if a[i] == 0:
			s0 += 1
		else:
			s1 += 1
	if s0 >= s1:
		print(s0)
		for j in range(s0):
			print('0 ', end='')
	else:
		if s1 & 1:
			s1 -= 1
		print(s1)
		for j in range(s1):
			print('1 ', end='')
	print()


def count(a=[], x=0):
	count = 0
	for i in range(len(a)):
		if a[i] == x:
			count += 1
	return count

def sol():
	n = int(input())
	a = [int(i) for i in input().split()]
	cnt0 = count(a)
	cnt1 = n - cnt0
	if cnt0 >= n // 2:
		for i in range(n - cnt0):
			a.remove(1)
		print(len(a))
		for i in range(len(a)):
			print(a[i], end=' ')
		print()
	elif cnt1 % 2 == 0:
		for i in range(n - cnt1):
			a.remove(0)
		print(len(a))
		for i in range(len(a)):
			print(a[i], end=' ')
		print()
	elif cnt0 != 1 or n == 2:
		for i in range(n - cnt1):
			a.remove(0)
		a.remove(1)
		print(len(a))
		for i in range(len(a)):
			print(a[i], end=' ')
		print()
	else:
		a.remove(1)
		a.remove(0)
		print(len(a))
		for i in range(len(a)):
			print(a[i], end=' ')
		print()
t = int(input())
while t > 0:
	t -= 1
	sol()


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))[:n]
	odd = 0
	even = 0
	(x, y) = (0, 0)
	for i in range(len(a)):
		if a[i] == 1:
			x = x + 1
		else:
			y = y + 1
	if x > y:
		if x % 2 == 0:
			print(x)
			print('1 ' * x, end=' ')
		else:
			print(x - 1)
			print('1 ' * (x - 1), end=' ')
	else:
		print(y)
		print('0 ' * y, end=' ')
	print()


def solution():
	n = int(input())
	c0 = 0
	c1 = 0
	l = list(map(int, input().split()))
	for i in range(n):
		a = l[i]
		if a == 0:
			c0 += 1
		else:
			c1 += 1
	if c0 >= c1:
		print(c0)
		for i in range(c0):
			print(0, end=' ')
	elif c0 < c1:
		print(c1 - c1 % 2)
		for i in range(c1 - c1 % 2):
			print(1, end=' ')
	print('')
t = int(input())
while t > 0:
	solution()
	t -= 1


for i in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	ones = 0
	for i in range(n):
		if arr[i] == 1:
			ones += 1
	if ones <= n // 2:
		print(n - ones)
		print(*[0 for j in range(n - ones)])
	elif ones % 2:
		print(ones - 1)
		print(*[1 for j in range(ones - 1)])
	else:
		print(ones)
		print(*[1 for j in range(ones)])


import sys
input = sys.stdin.readline
cases = int(input())
for case in range(cases):
	n = int(input())
	a = [int(x) for x in input().split()]
	(z, o) = (0, 0)
	for i in range(len(a)):
		if a[i] == 1:
			z += 1
		else:
			o += 1
	if z > o:
		if z & 1:
			z -= 1
		print(z)
		s = '1 ' * z
		print(s)
	else:
		print(o)
		s = '0 ' * o
		print(s)


import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
import threading
from collections import defaultdict
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n

class SegmentTree1:

	def __init__(self, data, default=2 ** 51, func=lambda a, b: a & b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: max(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] < key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def binary(x, length):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater
for ik in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	one = []
	zer = []
	for i in range(n):
		if l[i] == 1:
			one.append(1)
		else:
			zer.append(0)
	if len(one) > n // 2:
		if len(one) % 2 == 1:
			one = one[1:]
		print(len(one))
		print(*one)
	else:
		print(len(zer))
		print(*zer)


testcases = int(input())
for testcase in range(testcases):
	n = int(input())
	temparr = input()
	temparr = temparr.split()
	count0 = 0
	count1 = 0
	for i in temparr:
		if i == '0':
			count0 += 1
		else:
			count1 += 1
	half = n // 2
	ans = []
	if count1 <= half:
		ans = ['0' for _ in range(count0)]
		print(len(ans))
		print(' '.join(ans))
	else:
		if count1 & 1 == 1:
			ans = ['1' for _ in range(count1 - 1)]
		else:
			ans = ['1' for _ in range(count1)]
		print(len(ans))
		print(' '.join(ans))