Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation.

For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplus 6)$. At the same time, array $[1, 2, 1, 3]$ isn't good, as $1 + 2 + 1 + 3 = 7 \neq 2\cdot 1 = 2\cdot(1\oplus 2 \oplus 1 \oplus 3)$.

You are given an array of length $n$: $a_1, a_2, \dots, a_n$. Append at most $3$ elements to it to make it good. Appended elements don't have to be different. It can be shown that the solution always exists under the given constraints. If there are different solutions, you are allowed to output any of them. Note that you don't have to minimize the number of added elements!. So, if an array is good already you are allowed to not append elements.


-----Input-----

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10\,000$). The description of the test cases follows.

The first line of each test case contains a single integer $n$ $(1\le n \le 10^5)$ — the size of the array.

The second line of each test case contains $n$ integers $a_1, a_2, \dots, a_n$ ($0\le a_i \le 10^9$) — the elements of the array.

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


-----Output-----

For each test case, output two lines.

In the first line, output a single integer $s$ ($0\le s\le 3$) — the number of elements you want to append.

In the second line, output $s$ integers $b_1, \dots, b_s$ ($0\le b_i \le 10^{18}$) — the elements you want to append to the array.

If there are different solutions, you are allowed to output any of them.


-----Example-----
Input
3
4
1 2 3 6
1
8
2
1 1

Output
0

2
4 4
3
2 6 2



-----Note-----

In the first test case of the example, the sum of all numbers is $12$, and their $\oplus$ is $6$, so the condition is already satisfied.

In the second test case of the example, after adding $4, 4$, the array becomes $[8, 4, 4]$. The sum of numbers in it is $16$, $\oplus$ of numbers in it is $8$.

Difficulty: MEDIUM
Tags: Bit manipulation

Mathematics

Constructive algorithms
Skill types: Bit manipulation

Starter code:

Solutions:
from fractions import gcd
from heapq import *
import math
from collections import defaultdict, Counter, deque
from bisect import *
import itertools
import fractions
MOD = 10 ** 9 + 7

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		xor = a[0]
		su = a[0]
		for i in range(1, n):
			xor ^= a[i]
			su += a[i]
		if su == xor * 2:
			print(0)
			print('')
			continue
		if su < 2 * xor:
			if (2 * xor - su) % 2 == 0:
				print(2)
				print((2 * xor - su) // 2, (2 * xor - su) // 2)
				continue
		v = 2 ** 50
		if (2 * xor - su) % 2 == 1:
			v += 1
		su += v
		xor ^= v
		print(3)
		print(v, (2 * xor - su) // 2, (2 * xor - su) // 2)
main()
1


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
BUFSIZE = 8192
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')

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		(x, s) = (a[0], a[0])
		for i in range(1, n):
			s = s + a[i]
			x = x ^ a[i]
		print(2)
		print(x, s + x)
main()


import math
Q = int(input())
for _ in range(Q):
	n = int(input())
	arr = list(map(int, input().split()))
	summa = sum(arr)
	xor = 0
	for i in arr:
		xor ^= i
	ans = [0]
	if summa % 2 == 1:
		summa += 1
		xor ^= 1
		ans[0] = 1
	if xor * 2 < summa:
		t = math.log2(summa - xor)
		t = int(t + 1)
		xor ^= 2 ** t
		summa += 2 ** t
		ans[0] += 2 ** t
	ans.append((xor * 2 - summa) // 2)
	ans.append((xor * 2 - summa) // 2)
	print(len(ans))
	print(*ans)


for _ in range(int(input())):
	N = int(input())
	A = list(map(int, input().split()))
	print(2)
	suma = sum(A)
	xor = 0
	for i in A:
		xor = xor ^ i
	print(xor, xor + suma)


for i in range(int(input())):
	N = int(input())
	array = [int(x) for x in input().split()]
	total = sum(array)
	XOR = 0
	for i in array:
		XOR = XOR ^ i
	print('2')
	print(XOR, XOR + total)


t = int(input())
for _ in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	S = sum(A)
	X = 0
	for a in A:
		X = X ^ a
	if S % 2 == 0:
		b_1 = 10 ** 15
		S += b_1
		X = X ^ b_1
		b_2 = (X * 2 - S) // 2
		print(3)
		print(b_1, b_2, b_2)
	else:
		b_1 = 10 ** 15 + 1
		S += b_1
		X = X ^ b_1
		b_2 = (X * 2 - S) // 2
		print(3)
		print(b_1, b_2, b_2)


import sys, math
input = sys.stdin.readline

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

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

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

def invr():
	return map(int, input().split())
t = 1
t = inp()
for tt in range(t):
	n = inp()
	a = inlt()
	q = 0
	for i in range(len(a)):
		q = q ^ a[i]
	print(2)
	print(q, q + sum(a))


from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations
import sys
import bisect
import string
import math
import time
import random

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

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

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

def LI_():
	return [int(i) - 1 for i in input().split()]

def StoI():
	return [ord(i) - 97 for i in input()]

def ItoS(nn):
	return chr(nn + 97)

def GI(V, E, Directed=False, index=0):
	org_inp = []
	g = [[] for i in range(n)]
	for i in range(E):
		inp = LI()
		org_inp.append(inp)
		if index == 0:
			inp[0] -= 1
			inp[1] -= 1
		if len(inp) == 2:
			(a, b) = inp
			g[a].append(b)
			if not Directed:
				g[b].append(a)
		elif len(inp) == 3:
			(a, b, c) = inp
			aa = (inp[0], inp[2])
			bb = (inp[1], inp[2])
			g[a].append(bb)
			if not Directed:
				g[b].append(aa)
	return (g, org_inp)

def bit_combination(k, n=2):
	rt = []
	for tb in range(n ** k):
		s = [tb // n ** bit % n for bit in range(k)]
		rt += [s]
	return rt

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
YN = ['Yes', 'No']
mo = 10 ** 9 + 7
inf = float('inf')
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
input = lambda : sys.stdin.readline().rstrip()

def ran_input():
	import random
	n = random.randint(4, 16)
	(rmin, rmax) = (1, 10)
	a = [random.randint(rmin, rmax) for _ in range(n)]
	return (n, a)
show_flg = False
show_flg = True
ans = 0
t = I()
for _ in range(t):
	n = I()
	a = LI()
	(x, y) = (0, 0)
	for i in a:
		x += i
		y ^= i
	print(2)
	print(y, x + y)


def xor(l):
	s = 0
	for i in range(len(l)):
		s ^= l[i]
	return s
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	x = xor(l)
	s = sum(l)
	if 2 * x == s:
		print(0)
		print()
	else:
		print(2)
		print(x, s + x)


import sys

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

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())

def solve():
	n = mint()
	a = list(mints())
	x = 0
	y = 0
	for i in a:
		x += i
		y ^= i
	if x == 2 * y:
		print(0)
		print()
	else:
		print(2)
		print(y, x + y)
for i in range(mint()):
	solve()


t = int(input())
for i in range(0, t):
	n = int(input())
	b = input().split(' ')
	s = 0
	x = 0
	numeros = []
	for j in range(0, n):
		b[j] = int(b[j])
		s += b[j]
		x = x ^ b[j]
	if s == x * 2:
		pass
	elif s % 2 == 0 and s <= x * 2:
		numeros.append(int((2 * x - s) / 2))
		numeros.append(int((2 * x - s) / 2))
	else:
		numeros.append(int(s % 2 + 2 ** 50))
		x = x ^ s % 2 + 2 ** 50
		s += s % 2 + 2 ** 50
		numeros.append(int((2 * x - s) / 2))
		numeros.append(int((2 * x - s) / 2))
	print(len(numeros))
	if len(numeros) != 0:
		for j in range(0, len(numeros)):
			if j != len(numeros) - 1:
				print(numeros[j], end=' ')
			else:
				print(numeros[j])
	else:
		print('')


q = int(input())
while q:
	n = int(input())
	a = list(map(int, input().split()))
	xorr = 0
	summ = 0
	for i in range(n):
		xorr = xorr ^ a[i]
		summ += a[i]
	if 2 * xorr == summ:
		print(0)
		print()
	elif 2 * xorr > summ:
		if (2 * xorr - summ) % 2 == 0:
			print(2)
			print((2 * xorr - summ) // 2, (2 * xorr - summ) // 2)
		else:
			print(2)
			print(xorr, summ + xorr)
	else:
		print(2)
		print(xorr, summ + xorr)
	q -= 1


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

def si():
	return input()

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

def li():
	return list(mi())
import math
for i in range(ii()):
	n = ii()
	a = li()
	s = sum(a)
	xs = 0
	for i in range(n):
		xs ^= a[i]
	b = xs
	s += xs
	xs ^= xs
	print(2)
	print(b, s)


def to_2(x):
	ans = []
	while x > 0:
		ans.append(x % 2)
		x //= 2
	return ans[::-1]

def to_10(arr):
	ans = 0
	cur = 1
	for i in arr:
		ans += i * cur
		cur <<= 1
	return ans
t = int(input())
for kkk in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ss = sum(a)
	xx = 0
	for i in range(n):
		xx ^= a[i]
	xx <<= 1
	ss1 = to_2(ss)
	ss1.reverse()
	xx1 = to_2(xx)
	xx1.reverse()
	kek1 = [0 for i in range(50)]
	kek2 = [0 for i in range(50)]
	kek3 = [0 for i in range(50)]
	cur = 0
	cnt = 0
	while True:
		sum_is_ended = False
		xor_is_ended = False
		cursum = 0
		curxor = 0
		if cur >= len(ss1):
			sum_is_ended = True
			ss1.append(0)
			cursum = 0
		else:
			cursum = ss1[cur]
		if cur >= len(xx1):
			xor_is_ended = True
			xx1.append(0)
			curxor = 0
		else:
			curxor = xx1[cur]
		if xor_is_ended and sum_is_ended:
			break
		if cursum == curxor:
			pass
		elif cursum == 1 and curxor == 0:
			kek1[cur] = 1
			if len(xx1) <= cur + 1:
				xx1.append(0)
			xx1[cur + 1] += 1
			xx1[cur + 1] %= 2
			ost = 0
			ss1[cur] += 1
			if ss1[cur] == 2:
				ost = 1
				ss1[cur] = 0
			j = 1
			while ost:
				if len(ss1) <= cur + j:
					ss1.append(0)
				ss1[cur + j] += 1
				if ss1[cur + j] == 2:
					ost = 1
					ss1[cur + j] = 0
					j += 1
				else:
					break
		else:
			kek2[cur - 1] = 1
			kek3[cur - 1] = 1
			ost = 0
			ss1[cur] = 1
		cur += 1
	print(3)
	print(to_10(kek1), to_10(kek2), to_10(kek3))


import math
import os
import sys
input = lambda : sys.stdin.readline().strip('\r\n')

def cin():
	return sys.stdin.readline().strip('\r\n')

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

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

def cout(ans):
	sys.stdout.write(str(ans))

def endl():
	sys.stdout.write(str('\n'))

def ende():
	sys.stdout.write(str(' '))

def main():
	for _ in range(int(input())):
		n = int(cin())
		a = fora()
		sumt = x = 0
		for i in a:
			x ^= i
			sumt += i
		if sumt == 2 * x:
			cout(0)
		else:
			cout(2)
			endl()
			cout(x)
			ende()
			cout(sumt + x)
		endl()
main()


def arr_inp():
	return [int(x) for x in stdin.readline().split()]
from sys import *
from functools import *
from operator import *
for i in range(int(input())):
	(n, a) = (int(input()), arr_inp())
	(a1, s) = (reduce(xor, a), sum(a))
	if s == 2 * a1:
		print(0, '\n')
	else:
		print(2)
		print(a1, s + a1)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	sum1 = 0
	x = 0
	for i in range(n):
		sum1 += l[i]
		x ^= l[i]
	print(2)
	print(x, sum1 + x)


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

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

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

def inputstring():
	return [x for x in input()]

def inputstringnum():
	return [ord(x) - ord('a') for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
t = int(input())
for q in range(t):
	n = inputnum()
	a = inputlist()
	sm = 0
	xor = 0
	for i in range(n):
		xor ^= a[i]
		sm += a[i]
	print(2)
	print(xor, xor + sm)


for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	a = sum(li)
	b = 0
	for i in li:
		b ^= i
	if a == 2 * b:
		print(0)
		print('')
	else:
		ans = 2
		if a % 2 == 1:
			ans += 1
			a += 1
			b ^= 1
		print(ans)
		if ans == 3:
			print(1, end=' ')
		if a > 2 * b:
			print(b, a + b)
		else:
			print(abs(a - 2 * b) // 2, abs(a - 2 * b) // 2)


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

def solve():
	rli()
	nums = rli()
	ans = sum(nums)
	t1 = 0
	for n in nums:
		t1 = t1 ^ n
	ans += t1
	print(2)
	print(ans, t1)

def main():
	s = rli()[0]
	for i in range(s):
		solve()
main()


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split(' ')))
	xor = 0
	for i in l:
		xor ^= i
	print(2)
	print(xor, xor + sum(l))


te = int(input())
while te > 0:
	te -= 1
	n = int(input())
	p = list(map(int, input().split()))
	Xor = 0
	S = 0
	for i in p:
		S += i
		Xor ^= i
	print(2)
	print(Xor, S + Xor)


t = int(input())
for j in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	xo = a[0]
	for i in range(1, n):
		xo ^= a[i]
	q = []
	q.append(xo)
	su = sum(a) + xo
	q.append(su)
	print(2)
	print(*q)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	s = sum(arr)
	x = 0
	for i in arr:
		x ^= i
	print(2)
	print(x, s + x)


def main():
	answer = ''
	for test in range(int(input())):
		n = int(input())
		array = list(map(int, input().split(' ')))
		xor = 0
		for num in array:
			xor = xor ^ num
		summ = sum(array)
		if summ % 2 == 0:
			firstelement = 288230376151711744
		else:
			firstelement = 288230376151711745
		xor = xor ^ firstelement
		checkxor = xor
		summ += firstelement
		sec_and_third_element = (xor * 2 - summ) // 2
		answer += '3 \n' + str(firstelement) + ' ' + str(sec_and_third_element) + ' ' + str(sec_and_third_element) + '\n'
	print(answer)
main()


import sys
input = sys.stdin.readline

def iin():
	return int(input())

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

def main():
	t = iin()
	while t:
		t -= 1
		n = iin()
		a = lin()
		ans = []
		sm = sum(a)
		xsm = 0
		for i in a:
			xsm ^= i
		if sm != 2 * xsm:
			if xsm != 0:
				ans.append(xsm)
				sm += xsm
			ans.append(sm)
		print(len(ans))
		print(*ans)
main()


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	xor = 0
	sum1 = 0
	for i in range(n):
		xor = xor ^ a[i]
		sum1 = sum1 + a[i]
	if 2 * xor == sum1:
		print(0)
		print()
	else:
		print(2)
		print(xor, sum1 + xor)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(p) for p in input().split()]
	xor = arr[0]
	for i in range(1, len(arr)):
		xor = xor ^ arr[i]
	s = sum(arr)
	print(2)
	print(xor, s + xor)


from sys import stdin, stdout
from math import gcd, log2
import math
from collections import defaultdict
import sys
input = stdin.readline
print = stdout.write

def xor(a):
	xora = 0
	for i in range(len(a)):
		xora = xora ^ a[i]
	return xora
for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	suma = sum(a)
	xora = xor(a)
	print(str(2) + '\n')
	print(str(xora) + ' ' + str(xora + suma))
	print('\n')


from sys import stdin, stdout
import math
from bisect import bisect_left, bisect_right
input = lambda : stdin.readline().strip()
print = lambda s: stdout.write(s)
t = int(input())
for i in range(t):
	n = int(input())
	ls = list(map(int, input().split()))
	l1 = sum(ls)
	l2 = 0
	for i in ls:
		l2 ^= i
	if l1 == 2 * l2:
		print('0\n\n')
	else:
		m = max(len(bin(l1)[2:]), len(bin(l2)[2:])) + 1
		l1 = bin(l1)[2:].rjust(m, '0')
		l2 = bin(l2)[2:].rjust(m, '0')
		l1 = l1[::-1]
		l2 = l2[::-1]
		ans = ''
		carry = 0
		s = 0
		for i in range(m):
			ans += str(s ^ int(l1[i]) ^ carry)
			carry = int(l1[i]) & int(ans[i]) | int(ans[i]) & carry | carry & int(l1[i])
			s = int(l2[i]) ^ int(ans[i])
		print('1\n')
		print(str(int(ans[::-1], 2)) + '\n')


from sys import stdin
from collections import defaultdict

def give(num):
	return (0, num)
t = int(stdin.readline().strip())
for _ in range(t):
	n = int(stdin.readline().strip())
	arr = list(map(int, stdin.readline().split()))
	xor = 0
	for i in arr:
		xor ^= i
	if xor == 0:
		s = sum(arr)
		(a, b) = give(s)
		print(2)
		print(a, b)
	else:
		s = sum(arr) + xor
		a = xor
		(b, c) = give(s)
		print(3)
		print(a, b, c)


from math import log2
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	s = sum(a)
	sm = 0
	for ai in a:
		sm = sm ^ ai
	sm *= 2
	pm = 2 ** int(log2(10 ** 17))
	obj = pm + sm
	add = (obj - s) // 2
	if s % 2 == 1:
		add -= 1
	add2 = pm + 1 if s % 2 == 1 else pm
	print(3)
	print(add, add, add2)


import sys
import math
import random
input = sys.stdin.readline

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

def inara():
	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 _ in range(t):
	n = inp()
	ara = inara()
	tot = 0
	xor = 0
	for num in ara:
		tot += num
		xor ^= num
	print(2)
	print(tot + xor, xor)


t = int(input())
for _ in range(t):
	n = int(input())
	lista = list(map(int, input().split()))
	soma = lista[0]
	xor = lista[0]
	for i in range(1, len(lista)):
		soma += lista[i]
		xor ^= lista[i]
	print(2)
	print(f'{xor} {soma + xor}')


def inp(dtype=str, strip=True):
	s = input()
	res = [dtype(p) for p in s.split()]
	res = res[0] if len(res) == 1 and strip else res
	return res

def problem3():
	t = inp(int)
	for _ in range(t):
		n = inp(int)
		a = inp(int, strip=False)
		a_sum = sum(a)
		a_xor = a[0]
		for el in a[1:]:
			a_xor = a_xor ^ el
		x = a_xor
		b_sum = a_sum + x
		y = b_sum
		print(2)
		print(x, y)
problem3()


from collections import Counter
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt

def inp():
	return map(int, input().split())
mod = int(1000000000.0) + 7
for _ in range(int(input())):
	n = int(input())
	a = list(inp())
	temp = sum(a)
	right = 0
	for i in a:
		right ^= i
	if 2 * right == temp:
		print(0)
		print()
	else:
		print(2)
		print(right, temp + right)


t = int(input())

def solve():
	n = int(input())
	arr = map(int, input().split())
	s = x = 0
	for i in arr:
		s += i
		x ^= i
	if s & 1 == 1:
		print(3)
		x ^= 1
		s += 1
		print(1, x, s + x)
	else:
		print(2)
		print(x, s + x)
for _ in range(t):
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	(prod, su) = (0, 0)
	ai = list(map(int, input().split()))
	for e in ai:
		prod ^= e
		su += e
	ans = [prod, prod + su]
	print(len(ans))
	print(*ans)


t = int(input())
for zz in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	sum1 = sum(arr)
	xor1 = 0
	for i in range(n):
		xor1 = xor1 ^ arr[i]
	if 2 * xor1 == sum1:
		print(0)
		print()
	elif xor1 == 0:
		print(1)
		print(sum1)
	else:
		print(2)
		print(xor1, sum1 + xor1)


def solve():
	n = int(input())
	arr = [int(x) for x in input().split()]
	xor = 0
	for x in arr:
		xor ^= x
	arr.append(xor)
	sm = sum(arr)
	arr.append(sm)
	print(2)
	print(xor, sm)
t = int(input())
for _ in range(t):
	solve()


def f(l):
	print(len(l))
	print(' '.join(list(map(str, l))))
t = int(input())
for ii in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	xor = 0
	s = 0
	for a1 in a:
		xor ^= a1
		s += a1
	res = []
	tmp = 4 - s % 4 + 1000000000000000
	a.append(tmp)
	res.append(tmp)
	s += tmp
	xor ^= tmp
	ss = s // 2
	if ss == xor:
		f(res)
	elif ss < xor:
		tmp = xor - ss
		res.append(tmp)
		res.append(tmp)
		a.append(tmp)
		a.append(tmp)
		f(res)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	s = sum(l)
	x = l[0]
	for i in range(1, len(l)):
		x ^= l[i]
	if 2 * x == s:
		print(0)
		print()
	else:
		print(2)
		print(x, s + x)


import sys
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

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

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

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

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

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
input = sys.stdin.readline
t = ii()
for _ in range(t):
	n = ii()
	d = li()
	s = sum(d)
	a = 0
	for i in d:
		a ^= i
	if s == 2 * a:
		print('0\n')
	else:
		print(2)
		print(a, s + a)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	xor = arr[0]
	summ = sum(arr)
	for i in range(1, n):
		xor ^= arr[i]
	if summ == 2 * xor:
		print(0)
	else:
		print(2)
		print(xor, summ + xor)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	x = sum(a)
	y = 0
	for i in a:
		y ^= i
	print(2)
	print(y, x + y)


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	suma = sum(a)
	xor = a[0]
	for j in range(1, n):
		xor = xor ^ a[j]
	if suma == xor * 2:
		print(0)
		print()
	else:
		print(2)
		print(str(xor) + ' ' + str(suma + xor))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	s = 0
	x = 0
	for i in range(n):
		s += l[i]
		x = x ^ l[i]
	if s == 2 * x:
		print(0)
		print()
	elif x == 0:
		print(3)
		print(2, 2, s + 4)
	else:
		print(2)
		print(x, s + x)


import sys

def solution(a, n):
	s = sum(a)
	p = 1
	while p <= s:
		p <<= 1
	p <<= 1
	if s & 1 == 1:
		p |= 1
	xor = p
	for d in a:
		xor ^= d
	xor <<= 1
	x = xor - s - p >> 1
	return (p, x, x)

def main():
	case_num = int(input())
	for k in range(case_num):
		n = int(input())
		a = [int(i) for i in input().strip().split()]
		foo = solution(a, n)
		sys.stdout.write('%d\n' % len(foo))
		sys.stdout.write('%s\n' % ' '.join([str(i) for i in foo]))
main()


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	s = 0
	p = 0
	for i in map(int, input().split()):
		s += i
		p ^= i
	if s == p * 2:
		print(0, '\n')
	else:
		print(2)
		print(p, s + p)


for _ in range(int(input())):
	n = int(input())
	l = [*map(int, input().split())]
	total = sum(l)
	xor = 0
	for i in l:
		xor ^= i
	if total == 2 * xor:
		print(0)
		print()
	elif xor == 0:
		print(3)
		print(total + 2, 1, 1)
	else:
		print(2)
		print(xor, xor + total)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = sum(a)
	xor = 0
	for i in a:
		xor ^= i
	add = []
	if xor << 1 != c:
		add = [str(xor), str(c + xor)]
	print(len(add))
	print(' '.join(add))


import sys
t = int(sys.stdin.readline().rstrip())

def main():
	for _ in range(t):
		n = int(sys.stdin.readline().rstrip())
		(*a,) = map(int, sys.stdin.readline().split())
		s = 0
		xor = 0
		for i in range(n):
			s += a[i]
			xor ^= a[i]
		yield 2
		yield '{0} {1}'.format(xor, s + xor)
ans = main()
print(*ans, sep='\n')


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	x = 0
	s = sum(a)
	for i in range(n):
		x = x ^ a[i]
	print(2)
	print(x, end=' ')
	print(x + s)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

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

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def YES(c):
	return IF(c, 'YES', 'NO')

def Yes(c):
	return IF(c, 'Yes', 'No')

def main():
	t = I()
	rr = []
	for _ in range(t):
		n = I()
		a = LI()
		t = 0
		for c in a:
			t ^= c
		r = [t, sum(a) + t]
		rr.append(2)
		rr.append(JA(r, ' '))
	return JA(rr, '\n')
print(main())


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	SUM = sum(l)
	Xor = 0
	for i in range(len(l)):
		Xor = Xor ^ l[i]
	Xor = 2 * Xor
	if SUM == Xor:
		print(0)
		print('\n')
	else:
		Xor = Xor // 2
		a = Xor
		ans = SUM + a
		print(2)
		print(a, ans)


from sys import stdin, stdout
t = int(input())
for i in range(t):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	(s, x) = (0, 0)
	for j in range(n):
		s += a[j]
		x ^= a[j]
	print('2')
	print(x, s + x)


N = int(input())
for _ in range(N):
	n = int(input())
	k = 0
	seq = list(map(int, input().split()))
	s = sum(seq)
	for i in seq:
		k ^= i
	if k * 2 == s:
		print(0)
		print()
		continue
	ans = []
	if k:
		ans.append(k)
	s += k
	ans.append(s)
	print(len(ans))
	print(*ans)


import sys
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	n = int(input())
	lis = list(map(int, input().split()))
	S = sum(lis)
	X = 0
	for i in lis:
		X = X ^ i
	if S == 2 * X:
		print(0)
		print('')
	else:
		print(2)
		print(S + X, X)


for i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	b = 0
	a = 0
	for i in range(n):
		b ^= arr[i]
		a += arr[i]
	print(2)
	print(b, a + b)


r = lambda : map(int, input().split())
I = lambda : int(input())
for _ in range(I()):
	n = I()
	(summ, xorr) = (0, 0)
	for i in r():
		summ += i
		xorr ^= i
	diff = summ - xorr * 2
	if abs(diff) % 2:
		a = 10 ** 16 + 1
		summ += a
		xorr ^= a
		b = c = xorr - summ // 2
	else:
		a = 10 ** 16
		summ += a
		xorr ^= a
		b = c = xorr - summ // 2
	print(3)
	print(a, b, c)


t = int(input())
for i in range(t):
	n = int(input())
	array = list(map(int, input().split()))
	s = sum(array)
	xor = array[0]
	for j in range(1, n):
		xor ^= array[j]
	print(2)
	print(xor, s + xor)


for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	su = 0
	xor = 0
	for i in li:
		su += i
		xor ^= i
	print(2)
	print(xor, su + xor)


T = int(input())
for z in range(T):
	N = int(input())
	lst = list(map(int, input().split()))
	s = sum(lst)
	x = 0
	for elem in lst:
		x ^= elem
	if s == x * 2:
		print(0)
		print()
	else:
		print(2)
		print(x, x + s)


import sys
import bisect
from math import ceil, floor, factorial

def c(a, b):
	return int(factorial(a) / (factorial(b) * factorial(a - b)))
RI = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()
mod = 10 ** 9 + 7
for _ in range(int(ri())):
	n = int(ri())
	a = RI()
	summ = 0
	xor = 0
	for i in a:
		summ += i
		xor ^= i
	if summ == 2 * xor:
		print(0)
		print()
	else:
		a = xor
		summ += a
		b = summ
		print(2)
		print(a, b)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	sum_ = sum(a)
	or_ = 0
	for el in a:
		or_ ^= el
	print(2)
	print(or_, or_ + sum_)


import sys
import math
import bisect
from collections import deque
sys.setrecursionlimit(1000000000)

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

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

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

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

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

def rlinput():
	return list(rinput())

def modst(a, s):
	res = 1
	while s:
		if s % 2:
			res *= a
		a *= a
		s //= 2
	return res

def main():
	n = iinput()
	w = rlinput()
	s = w[-1]
	a = w[-1]
	for i in range(n - 1):
		s += w[i]
		a ^= w[i]
	if s == a * 2:
		print(0)
		print()
	else:
		print(2)
		print(a, s + a)
for i in range(iinput()):
	main()


for nt in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	s = sum(l)
	e = l[0]
	for i in range(1, n):
		e = e ^ l[i]
	if s == 2 * e:
		print(0)
		print()
	else:
		print(2)
		print(e, s + e)


tc = int(input())
while tc != 0:
	tc -= 1
	n = int(input())
	ar = list(map(int, input().split()))
	s = sum(ar)
	x = 0
	for i in ar:
		x ^= i
	print(2)
	print(x, s + x)


import sys
import math
import itertools
import functools
import collections
import operator

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

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

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

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

def wr(arr):
	return ' '.join(map(str, arr))

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
t = ii()
for _ in range(t):
	n = ii()
	a = li()
	suma = sum(a)
	xora = functools.reduce(operator.xor, a)
	if 2 * xora == suma:
		print(0)
		print()
	else:
		print(2)
		print(xora, xora + suma)


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	s = 0
	x = 0
	for i in range(n):
		s += a[i]
		x ^= a[i]
	print(2)
	print(x, s + x)


def list_xor(arr):
	a = 0
	for i in arr:
		a = a ^ i
	return a

def find_numbers(arr):
	s = sum(arr)
	x = list_xor(arr)
	b = []
	b.append(x)
	k = x
	x = x ^ k
	s = s + k
	if x != 0:
		raise Exception
	if s % 2 == 0:
		k = s
		b.append(s)
		s = s + k
		x = x ^ k
		if s != 2 * x:
			raise Exception(str(s) + ' ' + str(x))
		return b
	else:
		b.append(1)
		s = s + 1
		x = x ^ 1
		if s % 2 != 0:
			raise Exception
		k = s / 2 - 1
		b.append(k)
		s = s + k
		x = x ^ k
		if s != 2 * x:
			raise Exception
		return b
t = int(input())
for _ in range(t):
	size = int(input())
	array = [int(i) for i in input().split()]
	nums = find_numbers(array)
	print(len(nums))
	print(' '.join([str(i) for i in nums]))


import functools

def solve(A):
	xored = functools.reduce(lambda a, b: a ^ b, A, 0)
	summed = sum(A)
	if summed == 0:
		print(0)
		print()
		return
	if summed == 1:
		print(1)
		print(3)
		return
	second = 1
	while second & summed + xored == 0:
		second <<= 1
	third = summed + xored ^ second
	print(3)
	print(xored, second, third)
t = int(input())
for _ in range(t):
	n = int(input())
	A = [int(x) for x in input().split()]
	solve(A)


import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
write = sys.stdout.write

def ii():
	return int(readline())

def mi():
	return map(int, readline().rstrip().split())

def li():
	return list(readline().rstrip())

def lmi():
	return list(map(int, readline().rstrip().split()))

def end(*arg):
	print(*arg)
	sys.exit()

def main():
	t = ii()
	for _ in range(t):
		n = ii()
		a = lmi()
		s = sum(a)
		x = 0
		for i in range(n):
			x ^= a[i]
		if s != 2 * x:
			k1 = x
			s += k1
			k2 = s
			print(2)
			print(k1, k2)
		else:
			print(0)
			print()
	return
main()


t = int(input(''))
import math
for v in range(t):
	n = int(input(''))
	a = list(map(int, input('').split(' ')))
	add = sum(a)
	x = 0
	for i in range(n):
		x = x ^ a[i]
	print(2)
	ans1 = x
	ans2 = x + add
	print(str(ans1) + ' ' + str(ans2))


from collections import defaultdict
x = int(input())
for _ in range(x):
	n = int(input())
	a = list(map(int, input().split()))
	b = 0
	s = 0
	for i in a:
		s ^= i
		b += i
	lol = []
	if b == 2 * s:
		print(0)
	else:
		print(2)
		lol.append(s)
		lol.append(s + b)
	print(*lol)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	a = sum(l)
	xor = l[0]
	for i in range(1, n):
		xor ^= l[i]
	l.append(xor)
	a += l[-1]
	l.append(a)
	print(2)
	for i in range(len(l) - 1, len(l) - 3, -1):
		print(l[i], end=' ')
	print()


for test in range(int(input())):
	k = int(input())
	c1 = list(map(int, input().split()))
	x = 0
	s = sum(c1)
	answer = []
	for i in c1:
		x ^= i
	if s == 2 * x:
		print(0)
		print()
		continue
	elif s % 2 == 0:
		answer = [x, x + s]
		print(2)
		print(answer[0], answer[1])
	elif s % 2 == 1:
		s += 1
		x ^= 1
		answer = [1, x, x + s]
		print(3)
		print(answer[0], answer[1], answer[2])


from collections import *
from itertools import *
from random import *
from bisect import *
from string import *
from queue import *
from heapq import *
from math import *
from re import *
from sys import *

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

def zzz():
	return [int(i) for i in fast().split()]
(z, zz) = (input, lambda : list(map(int, z().split())))
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def output(answer):
	stdout.write(str(answer))
dx = [-1, 1, 0, 0, 1, -1, 1, -1]
dy = [0, 0, 1, -1, 1, -1, -1, 1]
for _ in ' ' * int(z()):
	n = int(z())
	arr = zzz()
	x = arr[0]
	s = x
	for i in arr[1:]:
		x = x ^ i
		s += i
	print(2)
	print(x, s + x)


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(n, val) for j in range(m)]

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()
	x = 0
	s = 0
	for i in range(n):
		x ^= arr[i]
		s += arr[i]
	print(2)
	print(x, x + s)


t = int(input())
i = 0
while i < t:
	n = int(input())
	arr = list(map(int, input().split()))
	a = sum(arr)
	s = 0
	for x in arr:
		s = s ^ x
	if a == 2 * s:
		print(0)
		print()
	else:
		print(2)
		print(s, a + s)
	i = i + 1


t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	lt = [int(x) for x in input().split()]
	sm = sum(lt)
	xr = 0
	for i in lt:
		xr = xr ^ i
	print(2)
	print(sm + xr, xr)


import os
import sys
from io import BytesIO, IOBase
from functools import reduce

def solution(arr):

	def xor(x, y):
		return x ^ y
	xx = reduce(xor, arr)
	sums = sum(arr)
	if sums == 2 * xx:
		write(f'0\n')
		return
	write(2)
	write(xx, sums + xx)

def main():
	for _ in range(r_int()):
		n = r_array()
		arr = r_array()
		solution(arr)
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))

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

def write(*args, end='\n'):
	for x in args[:-1]:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(str(args[-1]))
	sys.stdout.write(end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())
main()


for _ in ' ' * int(input()):
	a = int(input())
	x = 0
	s = 0
	for i in map(int, input().split()):
		x ^= i
		s += i
	print(2)
	print(x, s + x)


import functools
t = int(input())
for i in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	X = functools.reduce(lambda x, y: x ^ y, A)
	S = functools.reduce(lambda x, y: x + y, A)
	print(2)
	print(str(X) + ' ' + str(X + S))


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	s = sum(a)
	x = 0
	for i in range(n):
		x = x ^ a[i]
	diff = abs(x * 2 - s)
	if x * 2 == s:
		print('0\n')
	elif x == 0:
		print('1')
		print('{}'.format(s))
	else:
		print('2')
		print('{} {}'.format(x, s + x))


t = int(input())
for i in range(t):
	n = int(input())
	ar = [int(x) for x in input().split()]
	sm = 0
	xor = 0
	for j in range(n):
		sm += ar[j]
		xor ^= ar[j]
	if sm == 2 * xor:
		print('0')
	else:
		print('2')
		print(xor, sm + xor, end=' ')
	print()


for i in range(int(input())):
	n = int(input())
	(*a,) = map(int, input().split())
	print(3)
	s = sum(a)
	x = 0
	for i in a:
		x ^= i
	b = (1 << 55) - 2 ^ x
	print(b, (2 * ((1 << 55) - 2) - s - b) // 2, (2 * ((1 << 55) - 2) - s - b) // 2)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s = sum(a)
	x = a[0]
	for i in range(1, n):
		x = x ^ a[i]
	if 2 * x == s:
		print(0)
		print('')
	else:
		print(2)
		print(x, s + x)


from collections import Counter, defaultdict, deque
import heapq as hq
from itertools import count, islice
import math
import sys
input = sys.stdin.readline
tt = int(input())
for test in range(tt):
	n = int(input())
	arr = [int(x) for x in input().split()]
	xor = 0
	s = 0
	for el in arr:
		s += el
		xor ^= el
	print(2)
	print(xor, xor + s)


t = int(input())
for rwuer in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	x = l[0]
	s = l[0]
	for i in range(1, n):
		x = x ^ l[i]
		s += l[i]
	c = max(s, x) * 100
	if (s + c) % 2 == 1:
		c += 1
	aplusb = 2 * (x ^ c) - (s + c)
	a = aplusb // 2
	b = a
	print(3)
	print(a, b, c)


import os
from io import BytesIO, IOBase
import sys
from collections import defaultdict, deque, Counter
from math import sqrt, pi, ceil, log, inf, gcd, floor
from itertools import combinations

def main():
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		(su, z) = (sum(a), 0)
		for i in a:
			z = z ^ i
		if su == 2 * z:
			print(0)
		else:
			print(2)
			print(z, su + z)
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()


t = int(input())
arr = []
for _ in range(t):
	n = int(input())
	ar = list(map(int, input().strip().split()))
	(sm, xor) = (0, 0)
	for i in range(n):
		sm += ar[i]
		xor ^= ar[i]
	arr.append([sm, xor])
for i in range(t):
	if arr[i][0] == 2 * arr[i][1]:
		print(0, end='\n\n')
	elif arr[i][1] == 0:
		print(1)
		print(arr[i][0])
	else:
		print(2)
		print(arr[i][1], arr[i][0] + arr[i][1])


for i in ' ' * int(input()):
	n = int(input())
	L = list(map(int, input().split()))
	x = 0
	for i in L:
		x = x ^ i
	x *= 2
	s = sum(L)
	if s == x:
		print(0)
		print()
	elif s < x:
		if (x - s) % 2 == 0:
			print(2)
			print((x - s) // 2, (x - s) // 2)
		else:
			if x - s > 3:
				print(3)
				print(1, (x - s - 3) // 2, (x - s - 3) // 2)
			if x - s == 3:
				print(1)
				print(1)
			if x - s == 1:
				print(3)
				print(1, x // 2 - 1, s + x // 2)
	elif x == 0:
		print(1)
		print(s)
	else:
		print(2)
		print(x // 2, s + x // 2)


t = int(input())
for q in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	s = sum(arr)
	xor = arr[0]
	for i in range(1, len(arr)):
		xor ^= arr[i]
	if 2 * xor == s:
		print(0)
	else:
		print(2)
		print(xor, s + xor)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	sm = 0
	for i in range(n):
		sm = sm ^ l[i]
	if sum(l) == 2 * sm:
		print('0')
		print()
	else:
		print(2)
		print(sm, sm + sum(l))


for x in range(int(input())):
	n = int(input())
	ls = list(map(int, input().split()))
	sum = 0
	xorSum = 0
	for y in ls:
		sum += y
		xorSum ^= y
	app = []
	if sum == xorSum << 1:
		print('0\n')
		continue
	app.append((1 << sum.bit_length() + 1) - sum)
	sum += app[0]
	xorSum ^= app[0]
	val = abs(sum - (xorSum << 1)) // 2
	app.append(val)
	app.append(val)
	print(len(app))
	print(' '.join(map(str, app)))


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	s = 2
	xor = 0
	summ = sum(a)
	for j in range(n):
		xor = xor ^ a[j]
	ans = []
	ans.append(xor)
	ans.append(xor + summ)
	print(s)
	print(*ans)


for _ in range(int(input())):
	n = int(input())
	i = fg = 0
	l = list(map(int, input().split()))
	s = sum(l)
	for i in range(n):
		fg = fg ^ l[i]
	print(2)
	print(fg, s + fg)


import sys
input = sys.stdin.readline
t = int(input())
for you in range(t):
	n = int(input())
	l = input().split()
	li = [int(i) for i in l]
	xori = 0
	for i in li:
		xori ^= i
	sumi = sum(li)
	print(3)
	print(xori, xori + sumi, 0)


t = int(input())
while t:
	n = int(input())
	l = list(map(int, input().split()))
	S = sum(l)
	X = 0
	for i in range(n):
		X = X ^ l[i]
	temp = []
	count = 0
	if S == 2 * X:
		print(count)
	else:
		print(2)
		temp.append(X)
		temp.append(S + X)
		print(*temp)
	t -= 1


T = int(input())
x = 2 ** 57
for _ in range(T):
	input()
	a = list(map(int, input().split()))
	s = sum(a)
	o = 0
	for i in a:
		o ^= i
	print(3)
	u = x ^ o
	z = x - (s + u) // 2
	print(x ^ o, z, z)


import sys
INF = 10 ** 10
T = int(input())
for ti in range(T):
	n = int(input())
	A = input().split()
	A = [int(k) for k in A]
	(x, s) = (0, 0)
	for ai in A:
		s += ai
		x ^= ai
	print(2)
	print(str(x) + ' ' + str(s + x))


t = int(input())
ans = []

def solve(l):
	s = sum(l)
	xr = 0
	for i in l:
		xr ^= i
	if s == 2 * xr:
		return '0\n'
	else:
		return '2\n{} {}'.format(xr, s + xr)
for _ in range(t):
	n = int(input())
	l = [int(i) for i in input().split()]
	ans.append(solve(l))
for s in ans:
	print(s)


from sys import stdin
from math import gcd
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	arr = list(map(int, stdin.readline().split()))
	s = 0
	x = 0
	for i in range(n):
		s += arr[i]
		x ^= arr[i]
	print(2)
	print(x, s + x)


def compute(S, X):
	A = (S - X) // 2
	a = 0
	b = 0
	for i in range(64):
		Xi = X & 1 << i
		Ai = A & 1 << i
		if Xi == 0 and Ai == 0:
			pass
		elif Xi == 0 and Ai > 0:
			a = 1 << i | a
			b = 1 << i | b
		elif Xi > 0 and Ai == 0:
			a = 1 << i | a
		else:
			return
	return (a, b)
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	Sum = sum(l)
	xr = 0
	for x in l:
		xr = xr ^ x
	(a, b) = compute(2 ** 60 - Sum - xr, 2 ** 60 // 2)
	l.append(xr)
	l.append(a)
	l.append(b)
	xr = 0
	for x in l:
		xr = xr ^ x
	print(3)
	print(*l[-3:])


for _ in range(int(input())):
	n = int(input())
	A = [*map(int, input().split())]
	xor = 0
	su = 0
	for i in A:
		xor ^= i
		su += i
	print(2)
	print(xor, su + xor)


import sys
from functools import reduce
import operator

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

def getibit(x, i):
	x = x // (1 << i)
	return x % 2
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	xorres = reduce(operator.xor, arr)
	addres = reduce(operator.add, arr)
	xorres *= 2
	i = 0
	ans = 0
	while 1 << i <= addres or 1 << i <= xorres:
		xor = getibit(xorres, i)
		add = getibit(addres, i)
		if xor != add:
			xorres = xorres ^ 1 << i + 1
			addres = addres + (1 << i)
			ans += 1 << i
		i += 1
	print(1)
	print(ans)


t = int(input())

def cry(elem):
	y = 0
	for i in elem:
		y ^= i
	return y

def roar(stuff, indx):
	s[indx] += 1
for i in range(t):
	p = 1
	c = 0
	n = int(input())
	a = list(map(int, input().split()))
	(s, x) = ([0, 0, 0] + list(map(int, bin(sum(a))[2:])), list(map(int, bin(cry(a))[2:])))
	x = [0 for i in range(len(s) - len(x) - 1)] + x
	(nextsum, nextxor) = (False, False)
	ans = 0
	if s[-1] == 1:
		ans += 1
		(nextsum, nextxor) = (True, True)
	for i in range(-1, -len(x), -1):
		p *= 2
		(se, xe) = (s[i - 1], x[i])
		if nextsum:
			if se == 0:
				se = 1
				nextsum = False
			else:
				se = 0
				nextsum = True
		if nextxor:
			xe = 1 - xe
			nextxor = False
		if se != xe:
			ans += p
			c += 1
			if se == 0:
				se = 1
			else:
				se = 0
				nextsum = True
			nextxor = True
	print(1, ans, sep='\n')


from functools import reduce

def main():
	t = int(input())
	for i in range(t):
		solve()

def solve():
	n = int(input())
	arr = list(map(int, input().split(' ')))
	total_xor = reduce(lambda x, y: x ^ y, arr)
	total_arr = sum(arr)
	if total_arr == 2 * total_xor:
		print(0)
		print()
	else:
		curernt = total_arr + total_xor
		print(2)
		print(*[total_xor, total_arr + total_xor])
main()


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	s = 0
	xr = 0
	for i in a:
		xr = xr ^ i
		s = s + i
	iin = 55
	A = 1 << iin
	if s % 2 == 1:
		A += 1
	s += A
	xr ^= A
	B = (2 * xr - s) // 2
	print(3)
	print(A, B, B)


for _ in range(int(input())):
	input()
	a = list(map(int, input().split()))
	print(2)
	ans1 = 0
	for ai in a:
		ans1 ^= ai
	a.append(ans1)
	print(ans1, sum(a))


from functools import reduce

def go():
	n = int(input())
	a = list(map(int, input().split()))
	ax = reduce(lambda x, y: x ^ y, a)
	print(2)
	print(ax, sum(a) + ax)
t = int(input())
for _ in range(t):
	go()


def dtob(x):
	ans = ''
	while x > 0:
		ans = str(x % 2) + ans
		x = x // 2
	return ans

def xor(a, b):
	dif = abs(len(a) - len(b))
	c = ''
	if len(a) < len(b):
		a = '0' * dif + a
	else:
		b = '0' * dif + b
	for i in range(len(a)):
		if a[i] != b[i]:
			c += '1'
		else:
			c += '0'
	return c

def btod(x):
	x = int(x)
	ans = 0
	counter = 0
	while x > 0:
		ans += x % 10 * 2 ** counter
		x //= 10
		counter += 1
	return ans
t = int(input())
for i in range(t):
	l = int(input())
	nums = list(map(int, input().split()))
	bix = '0'
	for j in range(l):
		bix = xor(bix, dtob(nums[j]))
	dx = btod(bix)
	nums.append(dx)
	nums.append(sum(nums))
	print(2)
	print(nums[-2], nums[-1])


t = int(input())
while t:
	t = t - 1
	n = int(input())
	arr = [int(s) for s in input().split()]
	S = sum(arr)
	if n >= 2:
		X = arr[0] ^ arr[1]
		for i in range(2, n):
			X = X ^ arr[i]
	else:
		X = arr[0]
	print('2')
	print(S + X, X)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ans = []
	val = 0
	for i in a:
		val ^= i
	if val > 0:
		ans.append(val)
		ans.append(sum(a) + val)
	else:
		ans.append(sum(a))
	print(len(ans))
	print(*ans)


def dcb(num):
	res = ''
	temp = num % 2
	temp1 = int(num / 2)
	if temp1 < 2:
		res += str(temp) + str(temp1)
		return res
	else:
		res += str(temp)
		return res + dcb(temp1)
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	sum1 = 0
	xor1 = 0
	for i in range(n):
		sum1 += a[i]
		xor1 = xor1 ^ a[i]
	res = []
	if sum1 % 2 == 1:
		if xor1 == 1:
			res.append(3)
			sum1 += 3
			xor1 = xor1 ^ 3
		else:
			res.append(1)
			sum1 += 1
			xor1 = xor1 ^ 1
	if xor1 == 0:
		res.append(2)
		xor1 = 2
		sum1 += 2
	sum2 = 2 * xor1
	if sum2 == sum1:
		print(len(res))
		for i in res:
			print(i, end=' ')
		print()
	elif sum2 > sum1:
		diff = int((sum2 - sum1) / 2)
		res.append(diff)
		res.append(diff)
		print(len(res))
		for i in res:
			print(i, end=' ')
		print()
	else:
		res.append(xor1)
		sum1 += xor1
		res.append(sum1)
		print(len(res))
		for i in res:
			print(i, end=' ')
		print()


t = int(input())
LARGE = 2 << 55
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.append(LARGE)
	s = sum(l)
	if s % 2:
		s += 1
		l[-1] += 1
	x = 0
	for v in l:
		x ^= v
	assert s < 2 * x
	diff = 2 * x - s
	print(3)
	print(l[-1], diff // 2, diff // 2)


from collections import Counter
import string
import math
import sys
from fractions import Fraction

def array_int():
	return [int(i) for i in sys.stdin.readline().split()]

def vary(arrber_of_variables):
	if arrber_of_variables == 1:
		return int(sys.stdin.readline())
	if arrber_of_variables >= 2:
		return map(int, sys.stdin.readline().split())

def makedict(var):
	return dict(Counter(var))
testcases = vary(1)
for _ in range(testcases):
	n = vary(1)
	num = array_int()
	xor = 0
	for i in range(n):
		xor ^= num[i]
	if 2 * xor == sum(num):
		print(0)
		print()
	else:
		print(2)
		print(xor, xor + sum(num))


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	total = sum(a)
	xor = 0
	for i in range(n):
		xor ^= a[i]
	if total == 2 * xor:
		print(0)
		print()
		continue
	goal = 2 ** 50
	x = goal * 2 - total
	y = goal ^ xor
	ans1 = y
	ans2 = (x - y) // 2
	print(3)
	print(ans1, ans2, ans2)
	if total + ans1 + ans2 * 2 != 2 * (xor ^ ans1 ^ ans2 ^ ans2):
		raise Exception('hoge')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().strip().split()))
	vs = sum(a)
	xor = 0
	for e in a:
		xor = xor ^ e
	print(2)
	print(xor, vs + xor)


t = int(input())
for loop in range(t):
	n = int(input())
	a = input().split()
	xoor = 0
	suum = 0
	for i in range(n):
		xoor ^= int(a[i])
		suum += int(a[i])
	print(2)
	print(str(xoor) + ' ' + str(suum + xoor))


import sys
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().rstrip().split()))
	x = []
	xor = 0
	s = 0
	for j in range(n):
		xor = xor ^ arr[j]
		s = s + arr[j]
	if 2 * xor == s:
		print('0')
		print('')
	else:
		print('2')
		print(str(xor) + ' ' + str(s + xor))
	sys.stdout.flush()


def case():
	n = int(input())
	a = list(map(int, input().split()))
	(s, x) = (0, 0)
	for i in a:
		s += i
		x ^= i
	if s == 2 * x:
		print(0)
		print()
	else:
		print(2)
		print(x, s + x)
for _ in range(int(input())):
	case()


t = int(input())
for o in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	xor = 0
	for i in range(n):
		xor = xor ^ a[i]
	x = xor
	if x == 0:
		print(1)
		print(sum(a))
	else:
		print(2)
		a.append(x)
		print(x, sum(a))


T = int(input())
for t in range(T):
	n = int(input())
	a = [int(x) for x in input().split()]
	print(2)
	x = sum(a)
	y = a[0]
	for i in range(1, n):
		y = y ^ a[i]
	x += y
	print(x, y)


t = int(input())
for i in range(t):
	n = int(input())
	A = [int(j) for j in input().split()]
	summ = sum(A)
	bsum = A[0]
	for k in range(1, n):
		bsum ^= A[k]
	if summ == 2 * bsum:
		print(0)
		print()
	else:
		d = abs(summ - bsum) * 100
		if d == 0:
			d = 100
		if summ % 2 == 1:
			g1 = d + 1
			summ += d + 1
			bsum ^= d + 1
		else:
			g1 = d
			summ += d
			bsum ^= d
		ds = abs(summ - 2 * bsum) // 2
		g2 = ds
		g3 = ds
		print(3)
		print(g1, g2, g3)


from sys import stdin

def input():
	return stdin.readline()[:-1]

def intput():
	return int(input())

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

def intsput():
	return map(int, sinput())
debugging = False

def dprint(*args):
	if debugging:
		print(*args)
	else:
		pass
t = intput()
for _ in range(t):
	n = intput()
	a = list(intsput())
	places = [0] * 70
	for x in a:
		br = bin(x)[2:][::-1]
		for i in range(len(br)):
			if br[i] == '1':
				places[i] += 1
	b1 = 2 ** 54
	for i in range(54):
		if places[i] % 2:
			b1 += 2 ** i
	b2seed = 2 ** 55 - sum(a) - b1
	b2seed = bin(b2seed)[2:][::-1]
	b2 = [''] * 100
	for i in range(len(b2seed)):
		if b2seed[i] == '1':
			b2[i - 1] = '1'
		else:
			b2[i - 1] = '0'
	b2 = int(''.join(b2)[::-1], 2)
	print(3)
	print(b1, b2, b2)


from functools import *

def sxor(a):
	return reduce(lambda y, z: y ^ z, a)
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(s, x) = (sum(a), sxor(a))
	print(2)
	print(x, s + x)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s = sum(a) / 2
	ans = 0
	for x in a:
		ans ^= x
	if ans == s:
		print(0)
		print()
	else:
		ans = a[0]
		s = a[0]
		for x in range(1, n):
			ans ^= a[x]
			s += a[x]
		elem1 = ans
		elem2 = s + ans
		if elem1 == 0:
			print(1)
			print(elem2)
		else:
			print(2)
			print(elem1, elem2)


def solve(arr):
	xor = 0
	for i in arr:
		xor ^= i
	return [xor, sum(arr) + xor]
T = int(input())
for i in range(T):
	_ = int(input())
	arr = list(map(int, input().split()))
	print(len(solve(arr)))
	print(' '.join(map(str, solve(arr))))


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	s = sum(a)
	xor = 0
	for i in range(n):
		xor = xor ^ a[i]
	print(2)
	print(xor, s + xor)


n = int(input())
for o in range(n):
	n = int(input())
	l = list(map(int, input().split()))
	xor = 0
	s = sum(l)
	for i in l:
		xor ^= i
	req = s + xor
	print(2)
	print(str(xor) + ' ' + str(req))


from sys import stdin
MAX = 10 ** 9 + 1

def input():
	return stdin.readline()
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	axor = asum = a[0]
	for i in range(1, n):
		asum += a[i]
		axor ^= a[i]
	if asum == 2 * axor:
		print(0)
		print('')
	else:
		print(2)
		print(axor, asum + axor)


t = int(input())
while t > 0:
	n = int(input())
	list = [int(i) for i in input().split()]
	som = 0
	xor = 0
	for i in range(n):
		xor ^= list[i]
		som += list[i]
	if som == 2 * xor:
		print(0)
		print()
	else:
		print(2)
		print(xor, som + xor)
	t -= 1


t = int(input())
for _ in range(t):
	input()
	arr = tuple(map(int, input().split()))
	xor = 0
	for ele in arr:
		xor = xor ^ ele
	print(2)
	print(xor, xor + sum(arr))


import sys, os, io
import math, bisect, operator
(inf, mod) = (float('inf'), 10 ** 9 + 7)
from itertools import groupby, accumulate
from heapq import heapify, heappop, heappush
from collections import deque, Counter, defaultdict
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
Neo = lambda : list(map(int, input().split()))
(test,) = Neo()
for i in range(test):
	(n,) = Neo()
	A = Neo()
	s = sum(A)
	xor = 0
	for i in A:
		xor ^= i
	print(2)
	print(xor, xor + s)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	xor = a[0]
	sm = a[0]
	for i in range(1, n):
		xor = xor ^ a[i]
		sm += a[i]
	print(2)
	print(xor, sm + xor)


import sys
import math
import bisect

def main():
	for _ in range(int(input())):
		n = int(input())
		A = list(map(int, input().split()))
		total_sum = sum(A)
		total_xor = 0
		for a in A:
			total_xor ^= a
		if total_sum % 2 == 1:
			tmp = 2 ** 50 + 1
		else:
			tmp = 2 ** 50
		total_sum += tmp
		total_xor ^= tmp
		val = (total_xor * 2 - total_sum) // 2
		A.append(tmp)
		A.append(val)
		A.append(val)
		total_sum = sum(A)
		total_xor = 0
		for a in A:
			total_xor ^= a
		print(3)
		print('%d %d %d' % (tmp, val, val))
main()


for i in range(int(input())):
	n = int(input())
	data = [int(x) for x in input().split()]
	(a, b) = (sum(data), data[0])
	for j in range(1, n):
		b = b ^ data[j]
	if a == 2 * b:
		print(0)
		print()
	else:
		print(2)
		print(b, b + a)


def rint():
	return int(input())

def rints():
	return list(map(int, input().split()))
from functools import reduce
from operator import xor
t = rint()
for _ in range(t):
	n = rint()
	a = rints()
	s = sum(a)
	x = reduce(xor, a)
	print(2)
	print(x, s + x)


def run():
	import sys
	sys.stdin = open('/home/punit/Documents/Cpp Programs/input.txt', 'r')
	sys.stdout = open('/home/punit/Documents/Cpp Programs/output.txt', 'w')
	from math import ceil, sqrt, floor
for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	x = sum(li)
	y = 0
	for i in li:
		y = y ^ i
	print(2)
	print(y, end=' ')
	print(x + y)


from functools import reduce
from operator import xor
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	a_xor = reduce(xor, a)
	print(2)
	print(a_xor, sum(a) + a_xor)


for t in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	sm = 0
	xor = 0
	for i in a:
		sm += i
		xor ^= i
	print(2)
	print(xor, sm + xor)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	sum_arr = sum(arr)
	xor_arr = 0
	for i in range(n):
		xor_arr = xor_arr ^ arr[i]
	ans = []
	ans.append(xor_arr)
	y = sum_arr + xor_arr
	ans.append(y)
	print(len(ans))
	print(*ans)


t = int(input())
while t:
	n = int(input())
	l = list(map(int, input().split()))
	suma = sum(l[:])
	xor = 0
	for i in range(n):
		xor = xor ^ l[i]
	if suma == 2 * xor:
		print(0)
		print()
	else:
		print(2)
		print(xor, suma + xor)
	t -= 1


t = int(input())
while t > 0:
	n = input()
	a = list(map(int, input().split()))
	s = 0
	x = 0
	for i in range(0, int(n)):
		s = s + a[i]
		x = x ^ a[i]
	if s == 2 * x:
		print(0)
		print('')
	else:
		print(2)
		print(x, end=' ')
		print(s + x)
	t = t - 1


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	s = 0
	t1 = 0
	for i in a:
		s += i
		t1 ^= i
	print(2)
	print(t1, s + t1)


import math
t = int(input())
for q in range(0, t):
	n = int(input())
	a = list(map(int, input().split()))
	sm = 0
	xor = 0
	for i in range(0, n):
		sm = sm + a[i]
		xor = xor ^ a[i]
	if sm == 2 * xor:
		print(0)
		print(' ')
	else:
		print(2)
		print(xor, end=' ')
		print(xor + sm)


t = int(input())
for i in range(t):
	n = int(input())
	arr = [int(j) for j in input().split()]
	su = sum(arr)
	xor = 0
	for x in arr:
		xor = xor ^ x
	print(2)
	print(xor, su + xor)


from sys import stdin, stdout
from math import gcd, ceil, sqrt
from collections import Counter
from bisect import bisect_left, bisect_right
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
tc = ii1()
for _ in range(tc):
	n = ii1()
	arr = iia()
	xor = arr[0]
	for i in arr[1:]:
		xor ^= i
	arr.append(xor)
	tot = sum(arr)
	print(2)
	print(xor, tot)


from functools import reduce
t = int(input())
while t:
	t -= 1
	n = int(input())
	(*a,) = map(int, input().split())
	x = reduce(lambda x, y: x ^ y, a)
	s = sum(a)
	print(2)
	print(x, s + x)


import sys
import operator
from functools import reduce

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

def input_ints():
	return [int(_) for _ in input().split()]
T = int(input())
for cc in range(T):
	n = int(input())
	A = input_ints()
	x = sum(A)
	y = reduce(operator.xor, A, 0)
	if x == 2 * y:
		print(0)
		print()
	else:
		ans = [y]
		x += y
		ans.append(x)
		print(len(ans))
		print(' '.join((str(_) for _ in ans)))


for _ in ' ' * int(input()):
	a = int(input())
	b = list(map(int, input().split()))
	s = 0
	for i in b:
		s ^= i
	print(2, '\n', s, s + sum(b))


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	ans = 0
	summ = 0
	for i in range(n):
		ans ^= a[i]
		summ += a[i]
	summ += ans
	print(2)
	print(ans, summ)


for _ in range(int(input())):
	n = int(input())
	xor = 0
	suma = 0
	a = list(map(int, input().strip().split()))
	for i in range(n):
		xor = xor ^ a[i]
	suma = sum(a)
	if suma == 2 * xor:
		print(0)
		print()
	else:
		print(2)
		print(xor, end=' ')
		print(suma + xor)


from sys import stdin
import math
input = stdin.readline
t = int(input())

def getAns(n, a):
	s = sum(a)
	curr = a[0]
	for i in range(1, n):
		curr = a[i] ^ curr
	if s - curr * 2 == 0:
		print(0)
		print()
		return
	xor = curr ^ 3 * s
	nextele = curr ^ xor
	s += nextele
	d = (xor * 2 - s) // 2
	print(3)
	print(*[nextele, d, d])
for _ in range(t):
	getAns(int(input()), list(map(int, input().split(' '))))


results = []
for i in range(1, int(input()) + 1):
	xorsum = 0
	numlens = int(input())
	array = input().split()
	numbers = [int(x) for x in array]
	if numlens == 1:
		xorsum = numbers[0]
	else:
		for i in range(0, numlens):
			xorsum = xorsum ^ numbers[i]
	if sum(numbers) == xorsum * 2:
		results.append('0')
	else:
		results.append('2')
		results.append(str(xorsum) + ' ' + str(xorsum + sum(numbers)))
for i in results:
	print(i)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	xr = 0
	for i in arr:
		xr ^= i
	sm = sum(arr)
	print(2)
	print(xr, xr + sm)


t = int(input())
for q in range(t):
	n = int(input())
	lst = [int(i) for i in input().split()]
	(s, xor) = (sum(lst), lst[0])
	for i in range(1, len(lst)):
		xor ^= lst[i]
	if 2 * xor == s:
		print(0)
	else:
		print(2)
		print(xor, s + xor)


t = int(input())
for ti in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	sm = sum(a)
	xor = a[0]
	for i in range(1, len(a)):
		xor ^= a[i]
	if 2 * xor == sm:
		print('0')
		print()
	else:
		print('2')
		print(str(xor) + ' ' + str(sm + xor))


from operator import xor
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	sum_a = sum(a)
	x = a[0]
	for j in range(1, n):
		x = xor(x, a[j])
	if 2 * x == sum_a:
		print(0)
		print()
	else:
		j = 1
		while j < sum_a:
			j *= 2
		j *= 2
		ans = list()
		ans.append(x + j)
		add = x + j
		sum_a += add
		x = xor(x, add)
		add2 = (2 * x - sum_a) // 2
		if add2 != 0:
			ans.append(add2)
			ans.append(add2)
		sum_a += 2 * add2
		x = xor(x, add2)
		x = xor(x, add2)
		print(len(ans))
		print(*ans)


import sys
input = sys.stdin.buffer.readline
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	ps = sum(a)
	xor = 0
	for x in a:
		xor = xor ^ x
	xx = 2 ** 59 | xor
	z = 2 * 2 ** 59 - xx - ps
	print(3)
	print('{} {} {}'.format(xx, z // 2, z // 2))


t = int(input())
for c in range(t):
	n = int(input())
	(s, xr) = (0, 0)
	for i in input().split():
		x = int(i)
		s += x
		xr ^= x
	if s == xr * 2:
		print(0)
		print()
	else:
		print(2)
		print(xr, s + xr)


import sys
input = sys.stdin.readline

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

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

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

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

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

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
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

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

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
for _ in range(int(input())):
	n = int(input())
	a = int_array()
	x = sum(a)
	y = a[0]
	for i in a[1:]:
		y = y ^ i
	print(2)
	print(y, x + y)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(input().split())
	a = [int(x) for x in a]
	s = sum(a)
	xor = 0
	for x in a:
		xor ^= x
	if s == 2 * xor:
		print(0)
		print()
	elif s % 2 == 0 and s < 2 * xor:
		print(2)
		print(int((2 * xor - s) / 2), int((2 * xor - s) / 2))
	elif s % 2 == 1 and s < 2 * xor:
		if s + 1 < 2 * (xor ^ 1):
			print(3)
			print(1, int((2 * (xor ^ 1) - s - 1) / 2), int((2 * (xor ^ 1) - s - 1) / 2))
		else:
			a = 2 * (s + 1) + 1
			print(3)
			print(a, int((2 * (xor ^ a) - s - a) / 2), int((2 * (xor ^ a) - s - a) / 2))
	elif s % 2 == 0 and s > 2 * xor:
		a = 2 * (s + 1)
		print(3)
		print(a, int((2 * (xor ^ a) - s - a) / 2), int((2 * (xor ^ a) - s - a) / 2))
	elif s % 2 == 1 and s > 2 * xor:
		a = 2 * (s + 1) + 1
		print(3)
		print(a, int((2 * (xor ^ a) - s - a) / 2), int((2 * (xor ^ a) - s - a) / 2))


t = int(input())
while t > 0:
	n = int(input())
	Sum = 0
	sum_xor = 0
	A = [int(x) for x in input().split()]
	for x in A:
		Sum += x
		sum_xor = sum_xor ^ x
	if Sum == 2 * sum_xor:
		print('0\n')
		t -= 1
		continue
	if sum_xor != 0:
		y = sum_xor
		b = Sum + y
		print(2)
		print(str(y) + ' ' + str(b))
	else:
		a = Sum
		print(1)
		print(a)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	s = sum(a)
	add = []
	xor = 0
	for i in a:
		xor ^= i
	if s == 2 * xor:
		pass
	elif xor == 0:
		add.append(s)
	else:
		add.append(xor)
		s += xor
		add.append(s)
	print(len(add))
	print(*add)


from math import *
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	s = l[0]
	c = l[0]
	for i in range(1, n):
		s = s ^ l[i]
		c = c + l[i]
	c = c + s
	print(2)
	print(s, c)


t = int(input())
for i in range(t):
	n = int(input())
	ls = []
	x = 0
	ls = [int(a) for a in input().split()]
	for j in range(n):
		x = x ^ ls[j]
	sm = sum(ls)
	an = []
	an.append(x)
	an.append(sm + x)
	print(len(an))
	for a in an:
		print(a)


from sys import stdin, stdout
import math
from bisect import bisect_left, bisect_right
input = lambda : stdin.readline().strip()
print = lambda s: stdout.write(s)
t = int(input())
for i in range(t):
	n = int(input())
	ls = list(map(int, input().split()))
	l1 = sum(ls)
	l2 = 0
	for i in ls:
		l2 ^= i
	print('2\n')
	print(str(l1 + l2) + ' ' + str(l2) + '\n')


x = int(input())
for i in range(x):
	t = int(input())
	r = list(map(int, input().strip().split()))
	totalsum = sum(r)
	for i in range(t - 1):
		y = r.pop()
		r[0] = r[0] ^ y
	finalxor = r[0]
	print('2')
	print(str(finalxor) + ' ' + str(finalxor + totalsum))


import sys

def fastio():
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

def debug(*var, sep=' ', end='\n'):
	print(*var, file=sys.stderr, end=end, sep=sep)
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br
(t,) = I()
while t:
	t -= 1
	(n,) = I()
	a = I()
	(sm, xor) = (0, 0)
	for i in range(n):
		sm += a[i]
		xor ^= a[i]
	sm += xor
	a.append(sm)
	print(2)
	print(xor, sm)


import math
from math import ceil
from math import factorial
from collections import Counter
from operator import itemgetter
import bisect
ii = lambda : int(input())
iia = lambda : list(map(int, input().split()))
isa = lambda : list(input().split())
t = ii()
for _ in range(t):
	n = ii()
	a = iia()
	s = sum(a)
	x = 0
	for i in a:
		x ^= i
	if x * 2 == s:
		print(0)
		print()
	else:
		print(2)
		print(x, s + x)


for _ in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	x = 0
	for u in A:
		x ^= u
	s = sum(A) + x
	print(2, x, s)


import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	n = int(input())
	first = [int(i) for i in input().split()]
	xor = first[0]
	for i in range(1, n):
		xor ^= first[i]
	print(2)
	print(xor, sum(first) + xor)


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	s = sum(a)
	add = []
	xor = 0
	for i in a:
		xor ^= i
	print('2')
	print(xor, s + xor)


for _ in range(int(input())):
	n = int(input())
	s = 0
	x = 0
	l = list(map(int, input().split()))
	for i in range(n):
		s += l[i]
		x = x ^ l[i]
	diff = 2 * x - s
	if s == 2 * x:
		print(0)
	else:
		print(2)
		print(x, s + x)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().rstrip().split()))
	s = sum(a)
	c = 0
	for i in a:
		c = c ^ i
	if s == 2 * c:
		print(0)
		print()
	else:
		ans = []
		s += c
		ans.append(c)
		ans.append(s)
		print(2)
		print(str(c) + ' ' + str(s))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s = 0
	xor = 0
	for val in a:
		s += val
		xor ^= val
	if s == xor * 2:
		print('0\n')
	else:
		print('2\n%d %d' % (xor, s + xor))


kl = int(input())
for l in range(kl):
	n = int(input())
	sm = 0
	smd = 0
	for i in input().split():
		i = int(i)
		sm += i
		smd = smd ^ i
	print(2)
	print(smd, sm + smd)


t = int(input())
for T in range(t):
	n = int(input())
	xor = 0
	s = 0
	for i in list(map(int, input().split())):
		xor ^= i
		s += i
	print(2)
	print(xor, s + xor)


for _ in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	x = 0
	s = sum(arr)
	for i in range(n):
		x = x ^ arr[i]
	if sum(arr) == 2 * x:
		print(0)
		print()
	else:
		print(2)
		print(x, s + x)


from functools import reduce
from operator import xor
for _ in range(int(input())):
	n = int(input())
	a = [*map(int, input().split())]
	print(2)
	print(sum(a) + reduce(xor, a), reduce(xor, a))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	xor = 0
	for i in a:
		xor ^= i
	s = sum(a)
	if xor * 2 == s:
		print(0)
		print()
	elif 2 * xor - s >= 0 and (2 * xor - s) % 2 == 0:
		print(2)
		print((2 * xor - s) // 2, (2 * xor - s) // 2)
	elif (2 * xor - s) % 2 == 1:
		print(3)
		xor ^= 2 ** 55 - 1
		s += 2 ** 55 - 1
		print(2 ** 55 - 1, (2 * xor - s) // 2, (2 * xor - s) // 2)
	else:
		print(3)
		xor ^= 2 ** 55
		s += 2 ** 55
		print(2 ** 55, (2 * xor - s) // 2, (2 * xor - s) // 2)


q = int(input())
for _ in range(q):
	n = int(input())
	arr = list(map(int, input().split()))
	s = sum(arr)
	a = 0
	for num in arr:
		a ^= num
	print(2)
	print(a, s + a)


import sys, itertools as it
t = int(input())
for _ in range(t):
	n = int(input())
	(s, x) = (0, 0)
	for v in map(int, input().split()):
		s += v
		x ^= v
	print(2)
	print(x, s + x)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	total = sum(a)
	ans = a[0]
	for i in range(1, n):
		ans = ans ^ a[i]
	if total == 2 * ans:
		print(0)
		print('')
		continue
	x = ans
	if total % 2 == 1:
		nums = [3]
		ans = ans ^ 3
		nums += [ans]
		total = total + 3 + ans
		ans = 0
		nums += [total]
		print(3)
		print(' '.join((str(k) for k in nums)))
		continue
	else:
		nums = [ans]
		total += ans
		print(2)
		print(nums[0], total)


t = int(input())
for j in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	b = 0
	c = sum(a)
	for i in range(n):
		b = b ^ a[i]
	print(2)
	print(b, c + b)


q = int(input())
for _ in range(q):
	n = int(input())
	sum = 0
	a = list(map(int, input().split()))
	for i in range(0, n):
		sum += a[i]
	x = a[0]
	for i in range(1, n):
		x ^= a[i]
	print('2')
	sum += x
	print(x, sum)


x = int(input())
for i in range(x):
	q = int(input())
	l = [int(x) for x in input().split()]
	a = sum(l)
	b = 0
	for i in range(q):
		b = b ^ l[i]
	print('2')
	print(b, a + b)


T = int(input())
for _ in range(T):
	n = int(input())
	li = input().split()
	sm = 0
	xor = 0
	for i in range(n):
		sm = sm + int(li[i])
		xor = xor ^ int(li[i])
	if 2 * xor == sm:
		print('0')
		print('')
	else:
		print('2')
		s = ''
		s = str(xor) + ' '
		sm = sm + xor
		s = s + str(sm)
		print(s)


from math import *
import os, sys
from bisect import *
from io import BytesIO
sys.setrecursionlimit(10 ** 9)
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s = a[0]
	x = a[0]
	for i in range(1, n):
		s += a[i]
		x ^= a[i]
	a1 = x
	s += x
	x ^= x
	s += s
	x ^= s // 2
	a2 = s // 2
	print(2)
	print(a1, a2)


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase
from fractions import *

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
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')

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

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

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
for _ in range(Int()):
	n = Int()
	a = array()
	req = sum(a)
	xor = a[0]
	for i in a[1:]:
		xor ^= i
	if req == 2 * xor:
		print(0)
		print()
	else:
		print(2)
		print(req + xor, xor)


from sys import stdin
t = int(stdin.readline().strip())
for caso in range(t):
	n = int(stdin.readline().strip())
	s = list(map(int, stdin.readline().strip().split()))
	y = s[0]
	xor = s[0]
	for i in range(1, n):
		xor = xor ^ s[i]
		y += s[i]
	ans = []
	ans.append(xor)
	y += xor
	ans.append(y)
	print(2)
	print(*ans)


from functools import reduce
for t in range(int(input())):
	input()
	a = [int(i) for i in input().split()]
	b = reduce(lambda i, j: i ^ j, a)
	c = sum(a) + b
	print(f'2\n{b} {c}')


t = int(input())
for i in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	B = [0] * 70
	for j in range(n):
		k = A[j]
		l = 0
		while k != 0:
			if k % 2 == 1:
				B[l] += 1
			k //= 2
			l += 1
	Bh = B[:]
	C = [0] * 70
	for i in range(len(B)):
		if C[i] == 1:
			if B[i] % 2 == 0:
				B[i] += 1
		elif B[i] % 2 == 1:
			B[i] += 1
		k = B[i] - C[i]
		l = i
		while k != 0:
			if k % 2 == 1:
				if C[l] == 0:
					C[l] = 1
				else:
					ii = l
					while C[ii] == 1:
						C[ii] = 0
						ii += 1
					C[ii] = 1
			k //= 2
			l += 1
	ans = []
	for ii in range(3):
		if Bh == B:
			break
		aa = 0
		for jj in range(len(B)):
			if B[jj] - Bh[jj] > 0:
				aa += 2 ** jj
				B[jj] -= 1
		ans.append(aa)
	print(len(ans))
	print(' '.join([str(ii) for ii in ans]))


from math import *
from collections import *
import sys
sys.setrecursionlimit(10 ** 9)
t = int(input())
for y in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	s = x = 0
	for i in a:
		s += i
		x ^= i
	print(2)
	print(x, s + x)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	res = sum(a)
	xor = a[0]
	ans = []
	for i in range(1, n):
		xor ^= a[i]
	if res == 2 * xor:
		print(0)
		print('')
	else:
		ans.append(xor)
		ans.append(res + xor)
		print(len(ans))
		print(*ans)


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	actXor = 0
	for i in a:
		actXor ^= i
	suma = sum(a)
	if suma == 2 * actXor:
		print(0)
		print('')
	else:
		print(2)
		print(actXor, suma + actXor)


from random import randint
T = 1000
T = int(input())
flag1 = False
flag2 = False
flag3 = False
flag4 = False
for t in range(1, T + 1):
	n = int(input())
	a = list(map(int, input().split()))
	sum_ = sum(a)
	xor_ = 0
	for i in a:
		xor_ ^= i
	dif_ = sum_ - 2 * xor_
	appended = []
	if dif_ == 0:
		print(0)
		print()
		flag1 = True
		continue
	if dif_ > 0:
		if sum_ % 2 == 0:
			flag2 = True
			appended.append(2 ** 59)
			sum_ += 2 ** 59
			xor_ ^= 2 ** 59
			dif_ = sum_ - 2 * xor_
		else:
			flag3 = True
			appended.append(2 ** 59 + 1)
			sum_ += 2 ** 59 + 1
			xor_ ^= 2 ** 59 + 1
			dif_ = sum_ - 2 * xor_
	if dif_ % 2 != 0:
		flag4 = True
		for i in range(1, 100000, 2):
			if sum_ + i - 2 * (xor_ ^ i) < 0 and dif_ < 0:
				appended.append(i)
				sum_ += i
				xor_ ^= i
				dif_ = sum_ - 2 * xor_
				break
	if dif_ != 0:
		appended.append(-dif_ // 2)
		appended.append(-dif_ // 2)
	a += appended
	sum_ = sum(a)
	xor_ = 0
	for i in a:
		xor_ ^= i
	dif_ = sum_ - 2 * xor_
	assert dif_ == 0
	assert len(appended) <= 3
	for i in appended:
		assert i >= 0
	print(len(appended))
	print(*appended)


from functools import reduce
t = int(input())
for case in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	s = sum(a)
	m = reduce(lambda a, b: a ^ b, a)
	print(2)
	print(m, s + m)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

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

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

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect
from collections import deque, defaultdict, OrderedDict
import collections

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	for _ in range(ri()):
		n = ri()
		a = ria()
		x = 0
		s = sum(a)
		for i in range(n):
			x = x ^ a[i]
		print(2)
		print(x, s + x)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			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, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			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()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

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

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


q = int(input())
for _ in range(q):
	n = int(input())
	a = [int(x) for x in input().split()]
	b = 0
	for x in a:
		b = b ^ x
	c = sum(a) + b
	print('2')
	print(b, c)


for i in range(int(input())):
	a = input()
	arr = list(map(int, input().split()))
	(ok, nook) = (arr[0], arr[0])
	for j in range(1, len(arr)):
		ok += arr[j]
		nook ^= arr[j]
	if nook == 0:
		print(1)
		print(ok)
	else:
		print(2)
		print(nook, nook + ok)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	nimsum = 0
	for i in range(n):
		nimsum = nimsum ^ a[i]
	total = sum(a) + nimsum
	print(2)
	print(total, nimsum)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	sm = sum(a)
	xr = 0
	for q in a:
		xr ^= q
	print(2)
	print(xr, sm + xr)


def isKthBitSet(n, k):
	if n & 1 << k - 1:
		return True
	else:
		return False
t = int(input())
while t:
	n = int(input())
	a = input().split()
	for i in range(n):
		a[i] = int(a[i])
	x = sum(a)
	y = 0
	ls = [0 for i in range(36)]
	for i in range(n):
		y = y ^ a[i]
		for j in range(36):
			if isKthBitSet(a[i], j + 1):
				ls[j] += 1
	if x == 2 * y:
		print(0)
		print()
	elif x < 2 * y:
		if (2 * y - x) % 2 == 0:
			print(2)
			print((2 * y - x) // 2, (2 * y - x) // 2)
		elif ls[0] % 2 == 0:
			print(3)
			print(1, (2 * y - x + 1) // 2, (2 * y - x + 1) // 2)
		elif 2 * y - x == 1:
			print(3)
			print(2 ** 58 + 1, (2 ** 59 - 2 ** 58 - 2) // 2, (2 ** 59 - 2 ** 58 - 2) // 2)
		else:
			print(3)
			print(1, (2 * y - x - 3) // 2, (2 * y - x - 3) // 2)
	elif (x - 2 * y) % 2 == 0:
		print(3)
		d = x - 2 * y
		print(2 ** 58, (2 ** 59 - 2 ** 58 - d) // 2, (2 ** 59 - 2 ** 58 - d) // 2)
	elif ls[0] % 2 == 0:
		print(3)
		d = x - 2 * y
		print(2 ** 58 + 1, (2 ** 59 - 2 ** 58 - d + 1) // 2, (2 ** 59 - 2 ** 58 - d + 1) // 2)
	else:
		print(3)
		d = x - 2 * y
		print(2 ** 58 + 1, (2 ** 59 - 2 ** 58 - d - 3) // 2, (2 ** 59 - 2 ** 58 - d - 3) // 2)
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	tot = 0
	for j in l:
		tot ^= j
	print(2)
	print(sum(l) + tot, tot)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	sm = sum(arr)
	c = 0
	for num in arr:
		c ^= num
	print(2)
	print(c, c + sm)


t = int(input())
for tt in range(t):
	n = int(input())
	A = [int(x) for x in input().strip().split()]
	s = sum(A)
	xorx = 0
	for a in A:
		xorx = xorx ^ a
	print(2)
	print(xorx, s + xorx)


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		s = sum(a)
		x = 0
		for i in a:
			x = x ^ i
		print(2)
		print(x, s + x)
	return
main()


import math
import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	summ = sum(arr)
	xor = 0
	for i in range(n):
		xor = xor ^ arr[i]
	print(2)
	print(xor, summ + xor)


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	s = 0
	j = 0
	for i in range(n):
		s += arr[i]
		j ^= arr[i]
	if s == 2 * j:
		print(0)
		print()
	else:
		print(3)
		if s % 2 == 0:
			val = pow(2, 48)
			j = j ^ val
			s = s + val
			print((2 * j - s) // 2, (2 * j - s) // 2, val)
		else:
			val = pow(2, 48) + 1
			j = j ^ val
			s = s + val
			print((2 * j - s) // 2, (2 * j - s) // 2, val)


for __ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	s = sum(ar)
	x = 0
	for i in ar:
		x = x ^ i
	if s == 2 * x:
		print(0)
		print()
		continue
	print(2)
	print(x, x + s)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	x = 0
	s = 0
	for y in a:
		x ^= y
		s += y
	print('2\n%d %d' % (x, x + s))


import sys, math
MOD = 998244353
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(s, x) = (sum(a), 0)
	for i in range(n):
		x ^= a[i]
	(ts, tx) = (1 << 55, 1 << 54)
	a = x ^ tx
	b = c = (ts - s - a) // 2
	print(3)
	print(a, b, c)


import os
import operator
import sys
from io import BytesIO, IOBase

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

def main():
	for _ in range(int(input())):
		n = int(input())
		arr = inar()
		sm = 0
		ex = 0
		for i in range(n):
			ex = ex ^ arr[i]
			sm = sm + arr[i]
		print(2)
		print(ex, sm + ex)
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 functools import reduce
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	sm = sum(arr)
	xor = reduce(lambda x, y: x ^ y, arr)
	sm += xor
	print(2)
	print(xor, sm)


import sys

class CMakeGood:

	def solve(self):
		for _ in range(int(input())):
			n = int(input())
			a = [int(_) for _ in input().split()]
			sm = sum(a)
			xor = 0
			for i in range(n):
				xor ^= a[i]
			print(2)
			print(xor, sm + xor)
solver = CMakeGood()
input = sys.stdin.readline
solver.solve()


import sys, os, io
from math import ceil, sqrt
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	xor = 0
	s = sum(a)
	ans = []
	for i in a:
		xor ^= i
	ans.append(xor)
	ans.append(s + xor)
	print(2)
	print(*ans)


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')
testcases = int(input())
for j in range(testcases):
	n = int(input())
	vals = list(map(int, input().split()))
	summy = sum(vals)
	cur = vals[0]
	for s in range(1, n):
		cur = cur ^ vals[s]
	if cur != 0:
		outy = [cur, summy + cur]
		print(2)
		print(*outy)
	else:
		print(1)
		print(summy)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s = 0
	x = 0
	for i in range(n):
		s += a[i]
		x ^= a[i]
	if s == 2 * x:
		print('0')
		print()
	else:
		print(2)
		print(' '.join([str(x), str(s + x)]))


def xsum(a):
	result = 0
	for aa in a:
		result ^= aa
	return result

def solve():
	n = int(input())
	a = list(map(int, input().split()))
	(x, y) = (sum(a), xsum(a))
	print(2)
	print(y, x + y)

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


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	s = sum(a)
	x = 0
	for i in a:
		x ^= i
	if x * 2 == s:
		print(0)
		print()
		continue
	print(2)
	f = x
	se = s + x
	print(f, se)


from math import *
from sys import stdin
input = stdin.readline
IN = lambda : map(int, input().split())
for _ in range(int(input())):
	n = input()
	a = [*IN()]
	(x, s) = (0, sum(a))
	for i in a:
		x ^= i
	print(2)
	print(x, s + x)


for _ in range(int(input())):
	n = int(input())
	(s, x) = (0, 0)
	for elem in map(int, input().split()):
		s += elem
		x ^= elem
	print(2)
	print(s + x, x)


import bisect
from sys import stdin
t = int(stdin.readline())
for _ in range(t):
	flag = 0
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().strip().split()))
	sum_a = sum(a)
	xor_a = a[0]
	for i in range(1, n):
		xor_a ^= a[i]
	print(2)
	print(xor_a, xor_a + sum_a)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	k = sum(a)
	d = [0] * 40
	for j in range(n):
		s = ''
		l = a[j]
		while l != 0:
			s += str(l % 2)
			l = l // 2
		for u in range(len(s)):
			if s[u] == '1':
				d[u] += 1
	p = 0
	for j in range(40):
		d[j] = d[j] % 2
		if d[j] == 1:
			p += 2 ** j
	k += p
	print(2)
	print(p, k)


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	sums = sum(a)
	xsum = a[0]
	for i in range(1, n):
		xsum = xsum ^ a[i]
	if 2 * xsum == sums:
		print(0)
		print()
	else:
		print(2)
		print(xsum, ' ', xsum + sums)


import sys
from sys import stdin, stdout
import bisect
import math
import heapq

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 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

def main():
	t = inin()
	for _ in range(t):
		n = inin()
		a = ain()
		x = 0
		y = 0
		for i in a:
			x = x ^ i
			y = y + i
		p = x
		y = y + p
		print(2)
		print(p, y)
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'0'[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'0'[0]:
		A.append(sign * numb)
	return A
main()


t = int(input())
for test in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	s = sum(arr)
	x = 0
	for i in arr:
		x = x ^ i
	print('2')
	res = str(x) + ' ' + str(x + s)
	print(res)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	j = sum(arr)
	k = 0
	for i in range(n):
		k ^= arr[i]
	print(2)
	print(k, j + k)


t = int(input())
for case in range(t):
	n = int(input())
	arr = [int(zax) for zax in input().split()]
	SUM = sum(arr)
	XOR = 0
	for i in range(n):
		XOR ^= arr[i]
	print(2)
	print('{} {}'.format(XOR, SUM + XOR))


import sys
input = sys.stdin.readline
t = int(input())
for test in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	SUM = sum(A)
	XOR = 0
	for a in A:
		XOR ^= a
	print(2)
	print(XOR, XOR + SUM)


def main():
	for t in range(0, int(input())):
		n = input()
		arr = list(map(int, input().split()))
		bin_arr = []
		for x in arr:
			bin_arr.append(num_bin(x))
		xor_sum = bin_arr[0]
		add_count = 0
		nums_added = []
		for x in range(1, len(bin_arr)):
			xor_sum = x_or(xor_sum, bin_arr[x])
		if bin_num(xor_sum) == sum(arr) / 2:
			print('0')
			print('')
		else:
			print('2')
			print(bin_num(xor_sum), bin_num(xor_sum) + sum(arr))

def num_bin(num):
	el = num
	count = 0
	count_list = []
	while True:
		el = el // 2
		if el >= 1:
			count += 1
			continue
		count_list.append(count)
		if num - 2 ** count > 0:
			num = num - 2 ** count
			el = num
			count = 0
			continue
		else:
			break
	binary = []
	for n in range(0, max(count_list) + 1):
		binary.append(0)
	for i in count_list:
		binary[-(i + 1)] = 1
	if num == 0:
		binary = [0]
	return binary

def bin_num(b):
	num = 0
	for x in range(0, len(b)):
		if b[-(x + 1)] == 1:
			num = 2 ** x + num
	return num

def x_or(num1, num2):
	new_arr = []
	flag = False
	diff = len(num2) - len(num1)
	if len(num1) >= len(num2):
		diff = len(num1) - len(num2)
		flag = True
	if flag:
		for i in range(0, diff):
			new_arr.insert(i, num1[i])
		for i in range(0, len(num2)):
			if num1[i + diff] != num2[i]:
				new_arr.append(1)
			else:
				new_arr.append(0)
	else:
		for i in range(0, diff):
			new_arr.insert(i, num2[i])
		for i in range(0, len(num1)):
			if num2[i + diff] != num1[i]:
				new_arr.append(1)
			else:
				new_arr.append(0)
	return new_arr
main()


for tc in [0] * int(input()):
	n = int(input())
	l = list(map(int, input().split()))
	x = l[0]
	for i in l[1:]:
		x = x ^ i
	xx = sum(l)
	if 2 * x == xx:
		print(0)
		print()
	else:
		print(2)
		print(x, xx + x)


import math
from collections import Counter
t = int(input())
for i in range(t):
	xssum = 0
	summ = 0
	ans = []
	n = int(input())
	a = list(map(int, input().split()))
	flag = False
	for j in range(len(a)):
		xssum = xssum ^ a[j]
	if xssum != 0:
		ans.append(xssum)
		ans.append(sum(a) + ans[0])
	else:
		ans.append(sum(a))
	print(len(ans))
	for q in ans:
		print(q, end=' ')
	print()


for _ in range(int(input())):
	am = int(input())
	arr = list(map(int, input().split()))
	add = 0
	xor = 0
	used = []
	for i in range(am):
		add += arr[i]
		if i == 0:
			xor = arr[i]
		else:
			xor ^= arr[i]
	if add == 2 * xor:
		print(0)
		print('')
	else:
		used.append(xor)
		add += xor
		xor ^= xor
		used.append(add)
		xor ^= add
		print(len(used))
		print(*used)


def proc_case(a):
	sum = 0
	xor = 0
	for i in a:
		sum += i
		xor ^= i
	if sum == xor * 2:
		return (0, [])
	if xor == 0:
		return (1, [sum])
	return (2, [xor, xor + sum])
cases_num = int(input())
for _ in range(cases_num):
	_ = input()
	a = [int(i) for i in input().split(' ')]
	(c, nums) = proc_case(a)
	print(f"{c}\n{' '.join([str(i) for i in nums])}")


T = int(input())
for _ in range(T):
	n = int(input())
	a = [int(x) for x in input().split()]
	S = sum(a)
	X = 0
	for x in a:
		X ^= x
	print(2)
	print(X, X + S)


def xor_of_array(n):
	res = 0
	for i in n:
		res = res ^ i
	return res
for _ in [0] * int(input()):
	lens = int(input())
	arrs = [int(x) for x in input().split()]
	sum_arrs = sum(arrs)
	xor_arrs = xor_of_array(arrs)
	print(2)
	print(xor_arrs, xor_arrs + sum_arrs)


from functools import reduce
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	xor_l = reduce(lambda x, y: x ^ y, l)
	sum_l = sum(l) + xor_l
	print(2)
	print(xor_l, sum_l, sep=' ')


t = int(input())
for i in range(t):
	n = int(input())
	s = list(map(int, input().split()))
	ans1 = 0
	x = 0
	for i in range(n):
		ans1 ^= s[i]
		x += s[i]
	x += ans1
	ans2 = x
	print(2)
	print(ans1, ans2)


for u in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	x = 0
	s = sum(l)
	for i in l:
		x ^= i
	s = x + s
	print(2)
	print(x, s)


import sys
input = sys.stdin.readline
Q = int(input())
Query = []
for _ in range(Q):
	N = int(input())
	A = list(map(int, input().split()))
	Query.append((N, A))
for (N, A) in Query:
	x = 0
	s = 0
	for a in A:
		x ^= a
		s += a
	t = s % 2 + (1 << 50)
	s += t
	x ^= t
	d = (2 * x - s) // 2
	print(3)
	print(t, d, d)


from functools import reduce
import operator
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	s = sum(arr)
	x = reduce(operator.xor, arr)
	added = 2
	while added <= s:
		added *= 2
	if x % 2:
		added += 1
	s += added
	x ^= added
	b = (x * 2 - s) // 2
	print(3)
	print(added, b, b)


def main():
	n = int(input())
	lst = list(map(int, input().split()))
	sum = 0
	xor = 0
	for i in lst:
		sum += i
		xor = xor ^ i
	if sum == 2 * xor:
		print(0)
		print()
	else:
		sum += xor
		print(2)
		print(xor, sum)
t = int(input())
for i in range(t):
	main()


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	res = 0
	sa = 0
	for i in a:
		res ^= i
		sa += i
	if sa % 2:
		mnum = (1 << 59) - 1
	else:
		mnum = 1 << 59
	res = (mnum ^ res) * 2
	snum = (res - sa - mnum) // 2
	print(3)
	print(mnum, snum, snum)


import sys
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().strip().split()]
	a_sum = sum(a)
	a_xor = 0
	for aa in a:
		a_xor ^= aa
	b = a_sum ^ 2 * a_xor
	ans = []
	if b != 0:
		ans.append(a_xor)
		a_sum += a_xor
		a_xor = 0
		b = a_sum ^ 2 * a_xor
	if b != 0:
		ans.append(a_sum)
		a_xor ^= a_sum
		a_sum += a_sum
	print(len(ans))
	print(*ans)


h = int(input())
while h > 0:
	n = int(input())
	h -= 1
	s = 0
	x = 0
	k = list(map(int, input().split()))
	for l in k:
		s += l
		x = x ^ l
	print(2)
	print(x, s + x)


inp = lambda cast=int: [cast(x) for x in input().split()]
printf = lambda s='', *args, **kwargs: print(str(s).format(*args), flush=True, **kwargs)
(t,) = inp()
for _ in range(t):
	(n,) = inp()
	A = inp()
	s = sum(A)
	x = 0
	for a in A:
		x ^= a
	print(2)
	print(x, x + s)


def subsIns():
	for _ in range(t):
		n = int(input())
		(*a,) = [int(x) for x in input().split()]
		sum1 = sum(a)
		xor = 0
		for ele in a:
			xor ^= ele
		if sum1 == 2 * xor:
			yield 0
			yield ''
		elif xor == 0:
			yield 1
			yield sum1
		else:
			yield 2
			yield (str(xor) + ' ' + str(xor + sum1))
t = int(input())
ans = subsIns()
print(*ans, sep='\n')


import math
elem = int(input())
for x in range(elem):
	dlina = int(input())
	ar = []
	bitwise = 0
	for i in input().split():
		temp = int(i)
		ar.append(temp)
		bitwise = bitwise ^ temp
	if bitwise != 0:
		print(2)
		print(bitwise, sum(ar) + bitwise)
	else:
		print(1)
		print(sum(ar) + bitwise)


t = int(input())
z = []
k = []
for i in range(t):
	x = []
	n = int(input())
	a = list(map(int, input().split()))
	sum1 = sum(a)
	xor = 0
	for j in range(len(a)):
		xor = xor ^ a[j]
	if sum1 == 2 * xor:
		z.append(0)
	else:
		x.append(xor + sum1)
		x.append(xor)
		k.append(x)
		z.append(2)
j = 0
for i in range(len(z)):
	if z[i] == 0:
		print(z[i])
		print()
	else:
		print(z[i])
		print(k[j][0], end=' ')
		print(k[j][1])
		j += 1


for _ in range(int(input())):
	N = int(input())
	L = list(map(int, input().split()))
	XOR = 0
	SUM = 0
	for i in range(N):
		XOR = XOR ^ L[i]
		SUM = SUM + L[i]
	XOR = XOR * 2
	if XOR == SUM:
		print('0')
		print('\n')
	else:
		XOR = XOR // 2
		a = XOR
		b = SUM + XOR
		print('2')
		print(a, b)


I = input
for _ in range(int(I())):
	n = int(I())
	a = list(map(int, I().split(' ')))
	s = sum(a)
	x = a[0]
	if n > 1:
		x = a[0] ^ a[1]
		for i in range(2, n):
			x = x ^ a[i]
	if (s + x) % 2 == 0:
		print(2)
		print(x, s + x)
	else:
		print(3)
		f1 = s + x
		f = f1 + 1
		l = 0
		if f % 2 == 0:
			l = f + 1
		else:
			l = f - 1
		print(x, 1, l)


t = int(input())

def xor(A):
	x = 0
	for i in range(len(A)):
		x = A[i] ^ x
	return x
for i in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	x = sum(A)
	y = xor(A)
	print(2)
	print(y, x + y)


T = int(input())

def solve():
	N = int(input())
	A = list(map(int, input().split()))
	xor = 0
	sm = 0
	for a in A:
		xor ^= a
		sm += a
	print(2)
	print(xor, sm + xor)
for _ in range(T):
	solve()


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	x = s = l[0]
	for i in range(1, n):
		x ^= l[i]
		s += l[i]
	if 2 * x == s:
		print(0)
	else:
		p = s - x
		a = b = c = 0
		a = x
		b = s + x
		print(3)
		print(a, b, c)


t = int(input())
for query in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	a = 0
	for c in A:
		a += c
	b = 0
	for c in A:
		b = b ^ c
	print(2, b, a + b)


for case in range(int(input())):
	n = int(input())
	arr = tuple(map(int, input().split()))
	s = sum(arr)
	u = arr[0]
	for i in range(1, n):
		u ^= arr[i]
	if u * 2 == s:
		print('0\n')
	else:
		print(2)
		print(u, s + u)


for i in range(int(input())):
	x = int(input())
	m = list(map(int, input().split()))
	s = 0
	ss = 0
	for j in range(x):
		s = s ^ m[j]
		ss += m[j]
	if s == 0:
		print('1')
		print(ss)
	else:
		print('2')
		print(str(s) + ' ' + str(ss + s))


from math import *
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s = 0
	b = 0
	for i in a:
		s += i
		b ^= i
	print(3)
	print(s + b, b, 0)


import sys
input = sys.stdin.buffer.readline
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	xor = a[0]
	for el in a[1:]:
		xor ^= el
	num_1 = xor
	num_2 = sum(a) + xor
	print(2)
	print(num_1, num_2)


import math
T = int(input())
for _ in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	x = 0
	for i in A:
		x = x ^ i
	a = sum(A)
	print(2)
	print(x, a + x)


import sys
import bisect as bi
import math
from collections import defaultdict as dd
import queue
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().strip()

def inin():
	return int(input())
for _ in range(inin()):
	n = inin()
	a = ain()
	print(2)
	ans1 = 0
	for ai in a:
		ans1 ^= ai
	a.append(ans1)
	print(ans1, sum(a))


from sys import stdin

def rl():
	return [int(w) for w in stdin.readline().split()]
(t,) = rl()
for _ in range(t):
	(n,) = rl()
	a = rl()
	x = y = 0
	for ai in a:
		x += ai
		y ^= ai
	print(2)
	print(y, x + y)


t = int(input())
while t:
	t += -1
	n = int(input())
	l = list(map(int, input().split()))
	sm = 0
	xor = 0
	for i in range(n):
		sm += l[i]
		xor ^= l[i]
	print(2)
	print(xor, sm + xor)


import math
from decimal import Decimal
import heapq
from collections import deque

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def da():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	return (n, m, a)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def lol(lst, k):
	k = k % len(lst)
	ret = [0] * len(lst)
	for i in range(len(lst)):
		if i + k < len(lst) and i + k >= 0:
			ret[i] = lst[i + k]
		if i + k >= len(lst):
			ret[i] = lst[i + k - len(lst)]
		if i + k < 0:
			ret[i] = lst[i + k + len(lst)]
	return ret

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)

def fact(a, b):
	c = []
	ans = 0
	f = int(math.sqrt(a))
	for i in range(1, f + 1):
		if a % i == 0:
			c.append(i)
	l = len(c)
	for i in range(l):
		c.append(a // c[i])
	for i in range(len(c)):
		if c[i] <= b:
			ans += 1
	if a / f == f and b >= f:
		return ans - 1
	return ans
import math
from decimal import Decimal
import heapq
from collections import deque

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def da():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	return (n, m, a)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def lol(lst, k):
	k = k % len(lst)
	ret = [0] * len(lst)
	for i in range(len(lst)):
		if i + k < len(lst) and i + k >= 0:
			ret[i] = lst[i + k]
		if i + k >= len(lst):
			ret[i] = lst[i + k - len(lst)]
		if i + k < 0:
			ret[i] = lst[i + k + len(lst)]
	return ret

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)

def fact(a, b):
	c = []
	ans = 0
	f = int(math.sqrt(a))
	for i in range(1, f + 1):
		if a % i == 0:
			c.append(i)
	l = len(c)
	for i in range(l):
		c.append(a // c[i])
	for i in range(len(c)):
		if c[i] <= b:
			ans += 1
	if a / f == f and b >= f:
		return ans - 1
	return ans
for _ in range(int(input())):
	(n, a) = na()
	d = sum(a)
	x = 0
	for i in a:
		x ^= i
	print(2)
	print(d + x, x)


t = int(input())
for i in range(0, t):
	n = int(input())
	b1 = [int(x) for x in input().split()]
	resultado = b1[0]
	suma = b1[0]
	for i in range(1, n):
		resultado = resultado ^ b1[i]
		suma += b1[i]
	if 2 * resultado == suma:
		print(0)
		print()
	else:
		print(2)
		suma += resultado
		print(resultado, '', suma)


import sys

def main():
	tests = int(sys.stdin.readline()[:-1])
	for i in range(tests):
		n = int(sys.stdin.readline()[:-1])
		a = [int(x) for x in sys.stdin.readline()[:-1].split()]
		s = 0
		x = 0
		for j in range(n):
			s += a[j]
			x ^= a[j]
		if s == 2 * x:
			print(0)
			print()
		else:
			print(2)
			print(x, s + x)
main()


T = int(input().strip())
for _ in range(T):
	n = int(input().strip())
	l = list(map(int, input().strip().split()))
	(s, x) = (0, 0)
	for i in range(len(l)):
		s += l[i]
		x ^= l[i]
	print(2)
	print(x, s + x)


t = int(input())
for i in range(t):
	y = 0
	n = int(input())
	c = list(map(int, input().split()))
	for j in range(n):
		y = y ^ c[j]
	y = int(y)
	ch = y % 2
	d = 800 * sum(c)
	u = 10 * d + ch
	p = (2 * (u ^ y) - u - sum(c)) // 2
	print(3)
	print(u, p, p)


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().strip().split(' ')))
	y = sum(a)
	x = a[0]
	for i in a[1:]:
		x ^= i
	if y == 2 * x:
		print(0)
		print()
	elif x == 0:
		print(1)
		print(y)
	else:
		print(2)
		print(x, y + x)


import sys
from pprint import pprint

def do():
	n = int(input())
	l = list(map(int, input().split()))
	cur = 0
	for x in range(len(l)):
		cur ^= l[x]
	ss = sum(l)
	xx = 2 * cur
	diff = abs(ss - xx)
	if diff == 0:
		print(0)
		print()
		return
	import math
	a = 2 ** math.ceil(math.log2(ss) + 1)
	if diff & 1 == 1:
		a += 1
	res = [a]
	l.append(a)
	cur = 0
	for x in range(len(l)):
		cur ^= l[x]
	ss = sum(l)
	xx = 2 * cur
	diff = abs(ss - xx)
	if diff == 0:
		print(1)
		print(res[0])
		return
	print(3)
	print(res[0], diff // 2, diff // 2)
q = int(input())
for _ in range(q):
	do()


def main():

	def solve():
		n = int(input())
		aa = [int(a) for a in input().split()]
		sum = 0
		xor = 0
		for a in aa:
			sum += a
			xor ^= a
		print(2)
		print(xor, xor + sum)
	q = int(input())
	for _ in range(q):
		solve()
main()


for _ in [0] * int(input()):
	n = int(input())
	S = 0
	X = 0
	for i in list(map(int, input().split())):
		S += i
		X ^= i
	print(2)
	print(str(X) + ' ' + str(S + X))


import sys
import math
import bisect
import heapq
from bisect import bisect_right
from sys import stdin, stdout

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

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

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

def get_list_of_list(n):
	return [list(map(int, sys.stdin.readline().strip().split())) for _ in range(n)]

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

def myceil(x, y):
	return (x + y - 1) // y

def Solution(arr, n):
	xor = 0
	sm = sum(arr)
	for v in arr:
		xor ^= v
	print(2)
	print(xor, xor + sm)

def main():
	for _ in range(get_int()):
		n = get_int()
		arr = get_ints_in_list()
		Solution(arr, n)
main()


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	N = int(input())
	A = list(map(int, input().split()))
	s = sum(A)
	x = 0
	for a in A:
		x ^= a
	print(2)
	print(x, x + s)


for _ in range(int(input())):
	n = int(input())
	arr = [int(x) for x in input().split(' ')]
	xor = 0
	for var in arr:
		xor ^= var
	s = sum(arr)
	print(2)
	print(xor, s + xor)


def xor(s):
	ans = 0
	for i in s:
		ans ^= i
	return ans
T = int(input())
for case in range(T):
	n = int(input())
	s = list(map(int, input().split()))
	a = sum(s)
	b = xor(s)
	if a == 2 * b:
		ans = []
	else:
		ans = [b, a + b]
	print(len(ans))
	print(*ans)


import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
from typing import List

def solve(A):
	x = sum(A)
	xor = 0
	for v in A:
		xor ^= v
	if xor * 2 == x:
		return []
	k = x.bit_length()
	a = 1 << k
	if (x + a) % 2 != 0:
		a += 1
	x += a
	xor ^= a
	c = (2 * xor - x) // 2
	return [a, c, c]
T = int(input())
ans = []
for ti in range(T):
	N = int(input())
	A = [int(x) for x in input().split()]
	ans.append(solve(A))
print('\n'.join(['\n'.join([str(len(v)), ' '.join(map(str, v))]) for v in ans]))


import operator
from functools import reduce
from sys import stdin
input = stdin.readline
cas = int(input())
for _ in range(cas):
	n = int(input())
	a = list(map(int, input().split()))
	s = sum(a)
	x = reduce(operator.xor, a)
	print(2)
	print(x, s + x)


import random
debug = False
tc = int(input())
if debug:
	tc = random.randint(10, 10000)
for _ in range(tc):
	n = 0
	a = None
	if debug:
		n = random.randint(1, 10000)
		a = []
		for i in range(n):
			a.append(random.randint(0, 1000000))
	else:
		n = int(input())
		a = [int(x) for x in input().split()]
	su = sum(a)
	res = 0
	for i in range(n):
		res ^= a[i]
	if res * 2 != su:
		nw = []
		nw.append(res)
		nw.append(su + res)
		if debug:
			res = 0
			for i in range(n):
				res ^= a[i]
			res ^= nw[0]
			res ^= nw[1]
			if res * 2 != su + sum(nw):
				print(a + nw)
				print(res * 2 == su + sum(nw))
		print(len(nw))
		print(' '.join([str(x) for x in nw]))
	else:
		print(0)
		print()


t = int(input())
while t > 0:
	n = int(input())
	a = list(map(int, input().split()))
	xor = 0
	s = 0
	for each in a:
		xor = xor ^ each
		s = s + each
	if s == 2 * xor:
		print(0)
	else:
		print(2)
		a.append(xor)
		s = s + xor
		print(xor, s)
	t = t - 1


t = int(input())
for q in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ans1 = 0
	ans2 = 0
	for i in range(len(a)):
		ans1 += a[i]
		ans2 = ans2 ^ a[i]
	v = 2
	print(3)
	if ans1 % 2 == 1:
		c2 = ans2
		c1 = ans1
		c1 += 2 ** 55 + 1
		c2 = c2 ^ 2 ** 55 + 1
		ans2 = ans2 ^ 2 ** 55 + 1
		ans2 = ans2 * 2
		ans1 += 2 ** 55 + 1
		u = (ans2 - ans1) // 2
		c1 += u + u
		c2 = c2 ^ u
		c2 = c2 ^ u
		print(2 ** 55 + 1, u, u)
	else:
		ans2 = ans2 ^ 2 ** 55
		ans2 = ans2 * 2
		ans1 += 2 ** 55
		c2 = ans2
		c1 = ans1
		u = (ans2 - ans1) // 2
		print(2 ** 55, u, u)


for _ in range(int(input())):
	n = int(input())
	l = [int(i) for i in input().split(' ', n - 1)]
	s = 0
	x = 0
	for i in range(len(l)):
		s += l[i]
		x = x ^ l[i]
	print(2)
	print(x, s + x)


def solve(xr, sm):
	k = []
	if 2 * xr == sm:
		return []
	else:
		k.append(xr)
		k.append(sm + xr)
		return k
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	xr = 0
	sm = 0
	for i in l:
		xr = xr ^ i
		sm += i
	z = solve(xr, sm)
	print(len(z))
	print(*z)


for i in range(int(input())):
	(n, s, xor) = (input(), 0, 0)
	for j in map(int, input().split()):
		xor ^= j
		s += j
	print('0\n ' if s == 2 * xor else '2\n' + str(xor) + ' ' + str(s + xor))


t = int(input())
for _ in range(t):
	n = int(input())
	nn = [int(i) for i in input().split()]
	x = 0
	for i in nn:
		x ^= i
	ats = []
	if 2 * x == sum(nn):
		print(len(ats))
		print()
	else:
		ne = sum(nn) + x
		print(2)
		print(x, ne)


for t in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	s = 0
	x = 0
	for k in a:
		s += k
		x ^= k
	print(2)
	print(x, s + x)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	su = sum(l)
	xo = 0
	for j in range(n):
		xo ^= l[j]
	if 2 * xo == su:
		print(0)
		print()
	else:
		print(2)
		print(xo, su + xo)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().strip().split()))
	b = 0
	for j in a:
		b = b ^ j
	if b == 0:
		print(1)
		print(sum(a))
	else:
		print(2)
		print(b, sum(a) + b)


for tc in range(int(input())):
	n = int(input())
	ls = list(map(int, input().split()))
	xr = 0
	sm = sum(ls)
	for e in ls:
		xr ^= e
	nadd = 2 ** 50 + sm % 2
	sm += nadd
	xr = 2 * (xr ^ nadd)
	rem = (xr - sm) // 2
	print(3)
	print(nadd, rem, rem)


t = int(input())
from math import *
while t > 0:
	t -= 1
	n = int(input())
	a = [int(x) for x in input().split()]
	p = list(bin(sum(a)))[2:]
	s = sum(a)
	x = 0
	for i in range(n):
		x = x ^ a[i]
	if sum(a) == 2 * x:
		print(0)
		print()
		continue
	h = 0
	if x != 0:
		while 2 ** (int(ceil(log(x, 2))) + h) + x + s > 2 * 2 ** int(ceil(log(x, 2)) + h):
			h += 1
		f = 2 * 2 ** (int(ceil(log(x, 2))) + h) - (2 ** (int(ceil(log(x, 2))) + h) + x + s)
		f = int(f)
		if f == 0:
			print(1)
			print(int(2 ** (int(ceil(log(x, 2))) + h)) + x)
		else:
			print(3)
			print(2 ** (int(ceil(log(x, 2))) + h) + x, f // 2, f // 2)
	else:
		while 2 ** h + s > 2 * 2 ** h:
			h += 1
		f = 2 * 2 ** h - (2 ** h + s)
		f = int(f)
		if f == 0:
			print(1)
			print(int(2 ** h) + x)
		else:
			print(3)
			print(int(2 ** h) + x, f // 2, f // 2)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	S = 0
	X = 0
	arr = []
	for x in a:
		S += x
		X ^= x
	if S == 2 * X:
		print(0)
		print()
		continue
	arr.append(X)
	arr.append(S + X)
	print(2)
	for z in arr:
		print(z, end=' ')
	print()


T = int(input())
for t in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	val = sum(a)
	num = 0
	for x in a:
		num ^= x
	num2 = val + num
	print(2)
	print(num, num2)


import sys
zz = 1
sys.setrecursionlimit(10 ** 5)
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')
di = [[-1, 0], [1, 0], [0, 1], [0, -1]]

def fori(n):
	return [fi() for i in range(n)]

def inc(d, c, x=1):
	d[c] = d[c] + x if c in d else x

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

def li():
	return [int(xx) for xx in input().split()]

def fli():
	return [float(x) for x in input().split()]

def comp(a, b):
	if a > b:
		return 2
	return 2 if a == b else 0

def gi():
	return [xx for xx in input().split()]

def gtc(tc, ans):
	print('Case #' + str(tc) + ':', ans)

def cil(n, m):
	return n // m + int(n % m > 0)

def fi():
	return int(input())

def pro(a):
	return reduce(lambda a, b: a * b, a)

def swap(a, i, j):
	(a[i], a[j]) = (a[j], a[i])

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

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

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

def isvalid(i, j, n, m):
	return 0 <= i < n and 0 <= j < m

def bo(i):
	return ord(i) - ord('a')

def graph(n, m):
	for i in range(m):
		(x, y) = mi()
		a[x].append(y)
		a[y].append(x)
t = fi()
uu = t
while t > 0:
	t -= 1
	n = fi()
	a = li()
	s = x = 0
	for i in range(n):
		s += a[i]
		x ^= a[i]
	print(2)
	print(x, s + x)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s = 0
	x = 0
	for i in range(n):
		s += a[i]
		x = x ^ a[i]
	if s == 2 * x:
		print(0)
		print()
		continue
	ans = []
	if x != 0:
		ans.append(x)
		s += x
		x = 0
	ans.append(s)
	print(len(ans))
	print(*ans)


n = int(input())
for i in range(n):
	le = int(input())
	lis = list(map(int, input().split()))
	sm = 0
	sor = 0
	for i in lis:
		sm += i
		sor ^= i
	print(2)
	print(sm + sor, sor)


for test in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ost = 0
	s = 0
	for i in a:
		ost ^= i
		s += i
	s += ost
	print(2)
	print(ost, s)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	x = 0
	ms = []
	for j in range(n):
		x ^= a[j]
	if sum(a) % 2 == 1:
		x ^= 10 ** 18 - 1
		a.append(10 ** 18 - 1)
		ms.append(10 ** 18 - 1)
	else:
		x ^= 10 ** 18
		a.append(10 ** 18)
		ms.append(10 ** 18)
	z = 2 * x - sum(a)
	ms.append(z // 2)
	ms.append(z // 2)
	print(len(ms))
	print(*ms)


x = int(input())
for i in range(x):
	s = 0
	m = 0
	y = int(input())
	z = list(map(int, input().split(' ')))
	for i in range(y):
		s = s + z[i]
		m = m ^ z[i]
	print(2)
	print(m, s + m)


Ans = []
for j in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	x = A[0]
	for i in range(1, len(A)):
		x ^= A[i]
	z1 = x
	Ans.append([z1, sum(A) + z1])
for a in Ans:
	print(2)
	print(*a)


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

def solve():
	n = int(input())
	a = list(map(int, input().split()))
	sa = sum(a)
	xa = 0
	for i in a:
		xa ^= i
	b0 = xa
	b1 = sa + xa
	print(2)
	print(b0, b1)
t = int(input())
for i in range(t):
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a_sum = 0
	a_xor = 0
	for x in a:
		a_sum += x
		a_xor ^= x
	if a_sum == 2 * a_xor:
		print(0)
		print()
	else:
		b1 = a_xor
		a_sum += b1
		a_xor ^= b1
		assert a_sum % 2 == 0
		assert a_xor == 0
		p = 1
		while p <= a_sum:
			p *= 2
		b1 += p
		b2 = 0
		a_sum += p
		a_xor = p
		i = 1
		while i <= p:
			if a_sum % (2 * i):
				b2 += i // 2
				a_sum += i
			i *= 2
		print('3')
		print(b1, b2, b2)
		a_sum = 0
		a_xor = 0
		for x in a + [b1, b2, b2]:
			a_sum += x
			a_xor ^= x
		assert a_sum == 2 * a_xor


def xor(arr):
	if len(arr) == 1:
		return arr[0]
	else:
		ans = arr[0] ^ arr[1]
		for i in range(2, len(arr)):
			ans = ans ^ arr[i]
		return ans
t = int(input())
for i in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	s = sum(arr)
	x = xor(arr)
	if s == 2 * x:
		print(0)
		print(' ')
	else:
		print(2)
		print(x, s + x)


for _ in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	y = x[0]
	z = x[0]
	for i in range(1, n):
		y ^= x[i]
		z += x[i]
	print(2)
	z += y
	print(y, z)


from functools import reduce
import operator
case = int(input())
for _ in range(case):
	n = int(input())
	l = list(map(int, input().split(' ')))
	if len(l) == 1:
		if l[0] % 2 == 0:
			temp = int(l[0] / 2)
			print(2)
			print(str(temp) + ' ' + str(temp))
			continue
		else:
			print(3)
			s = l[0]
			xor = l[0] ^ 1
			s += 1 + xor
			print('1 ' + str(xor) + ' ' + str(s))
			continue
	s = sum(l)
	xor = reduce(operator.xor, l)
	if s % 2 == 1:
		xor ^= 1
		s += xor + 1
		print(3)
		print(str(xor) + ' ' + str(1) + ' ' + str(s))
	else:
		s += xor
		print(2)
		print(str(xor) + ' ' + str(s))


t = int(input())
while t != 0:
	n = int(input())
	list1 = list(map(int, input().split()))
	(s, x) = (0, 0)
	for i in range(n):
		x = x ^ list1[i]
		s = s + list1[i]
	print(2)
	print(x, x + s)
	t -= 1


import sys
from math import gcd
from heapq import heappop
from heapq import heappush
from heapq import heapify
from bisect import insort
from bisect import bisect_right
from bisect import bisect_left
from sys import stdin, stdout
from collections import defaultdict, deque
from math import log2, ceil, floor
inp = lambda : int(input())
sip = lambda : input()
mulip = lambda : map(int, input().split())
lst = lambda : list(map(int, input().split()))
slst = lambda : list(sip())
arr2d = lambda x: [[int(j) for j in input().split()] for i in range(x)]
odds = lambda l: len(list(filter(lambda x: x % 2 != 0, l)))
evens = lambda l: len(list(filter(lambda x: x % 2 == 0, l)))
mod = pow(10, 9) + 7
Judge = 0
if Judge:
	sys.stdin = open('input.in', 'r')
for _ in range(inp()):
	n = inp()
	a = lst()
	s = sum(a)
	x = 0
	for i in a:
		x = x ^ i
	print(2)
	print(x, x + s)


for _ in range(int(input())):
	N = int(input())
	X = list(map(int, input().split()))
	SUM = sum(X)
	XOR = 0
	for i in X:
		XOR ^= i
	print('2')
	print(XOR, SUM + XOR)


for i in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	a = sum(x)
	b = 0
	for j in x:
		b = b ^ j
	print(2)
	print(b, a + b)


def xor(a):
	ans = 0
	for i in range(n):
		ans ^= a[i]
	return ans
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	ans = []
	sm = sum(a)
	xora = xor(a)
	if sm == 2 * xora:
		pass
	elif xor(a) == 0:
		ans.append(sm)
	else:
		ans.append(xora)
		ans.append(sm + xora)
	print(len(ans))
	for i in ans:
		print(i, end=' ')
	print()


from functools import reduce
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	res = reduce(lambda x, y: x ^ y, a)
	if sum(a) == 2 * res:
		print(0)
		print()
	elif res == 0:
		print(1)
		print(sum(a))
	else:
		print(2)
		print(res, sum(a) + res)


t = int(input())
for I in range(t):
	n = int(input())
	li = list(map(int, input().split()))
	sum1 = 0
	x = 0
	for pp in li:
		num = int(pp)
		sum1 += int(num)
		x ^= int(num)
	print(2)
	print(str(x) + ' ' + str(sum1 + x))


t = int(input())
for i in range(t):
	n = int(input())
	L = list(map(int, input().split()))
	y = sum(L)
	p = 0
	for x in L:
		p ^= x
	print(2)
	print(p, y + p)


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	c = l[0]
	d = l[0]
	for i in range(1, n):
		c += l[i]
		d ^= l[i]
	if c == 2 * d:
		print(0)
		print('')
	else:
		print(2)
		print(str(d) + ' ' + str(c + d))


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	am = sum(a)
	xo = 0
	for x in a:
		xo = xo ^ x
	print(2)
	print(am + xo, xo)


def solve():
	x = int(input())
	s = list(map(int, input().split()))
	xr = 0
	for n in s:
		xr ^= n
	sm = sum(s)
	print(2)
	print(xr, sm + xr)
for n in range(int(input())):
	solve()


t = int(input())
for z in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	xor = arr[0]
	for i in range(1, n):
		xor = xor ^ arr[i]
	print('2')
	print(xor, sum(arr) + xor)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	xor_ = 0
	sum_ = 0
	for i in range(n):
		xor_ ^= a[i]
		sum_ += a[i]
	print(2)
	print(xor_, sum_ + xor_)


import sys
input = sys.stdin.readline
t = int(input())
inf = 10 ** 18
for _ in range(t):
	n = int(input())
	it = list(map(int, input().split()))
	x = sum(it)
	y = it[0]
	for i in range(1, n):
		y = y ^ it[i]
	if x % 2 == 0:
		x += inf
		y = (y ^ inf) * 2
		print(3)
		print(inf, (y - x) // 2, (y - x) // 2)
	else:
		x += inf - 1
		y = (y ^ inf - 1) * 2
		print(3)
		print(inf - 1, (y - x) // 2, (y - x) // 2)


t = int(input())
for i in range(t):
	n = int(input())
	l1 = list(map(int, input().split()))
	x = 0
	for j in range(n):
		x ^= l1[j]
	print(2)
	print(x, sum(l1) + x)


from collections import *
import sys
input = sys.stdin.readline

def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))
t = ri()
for _ in range(t):
	n = ri()
	aa = rl()
	XOR_S = 0
	S = sum(aa)
	for k in range(30):
		sum_bits = 0
		for i in range(n):
			if aa[i] & 1 << k:
				sum_bits += 1
		if sum_bits % 2 == 1:
			XOR_S += 1 << k
	if S % 2 == 0:
		b1 = 2 ** 50
		S = S + 2 ** 50
		twoXOR = 2 * XOR_S + 2 ** 51
		delta = twoXOR - S
		b2 = delta // 2
		b3 = delta // 2
	if S % 2 == 1:
		b1 = 2 ** 50 + 1
		S = S + 2 ** 50 + 1
		new_XOR = 2 ** 50 + (XOR_S - 1)
		twoXOR = 2 * new_XOR
		delta = twoXOR - S
		b2 = delta // 2
		b3 = delta // 2
	print(3)
	print(b1, b2, b3)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	x = a[0]
	for i in a[1:]:
		x ^= i
	a.append(x)
	s = sum(a)
	print(2)
	print(x, s)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	su = a[0]
	xo = a[0]
	for i in range(1, n):
		su += a[i]
		xo = xo ^ a[i]
	print(2)
	print(xo, su + xo)


for i in range(int(input())):
	a = int(input())
	s = list(map(int, input().split()))
	t = sum(s)
	g = 0
	for i in s:
		g ^= i
	print(2)
	print(g, g + t)


t = int(input())
for q in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	s = 0
	x = 0
	for i in range(n):
		s += a[i]
		x ^= a[i]
	if x * 2 == s:
		print(0)
		continue
	print(2)
	print(x, s + x)


for _ in range(int(input())):
	a = int(input())
	s1 = list(map(int, input().split()))
	xx = 0
	for i in range(a):
		xx ^= s1[i]
	ss = sum(s1)
	if 2 * xx == ss:
		print('0')
		print()
	elif xx == 0:
		print('1')
		print(ss)
	else:
		print('2')
		print(xx, sum(s1) + xx)


import sys
import math
from collections import Counter
import bisect
ma = lambda : map(int, input().split())
inp = lambda : [int(i) for i in input().split()]
s = sorted
for _ in range(int(input())):
	n = ma()
	A = inp()
	s = sum(A)
	xor = 0
	for i in A:
		xor ^= i
	if 2 * xor == s:
		print(0)
		print()
	else:
		print(2)
		print(xor, s + xor)


from functools import reduce
from operator import xor
t = int(input())
while t:
	t -= 1
	n = int(input())
	l = list(map(int, input().split()))
	x = sum(l)
	y = reduce(xor, l)
	if x == 2 * y:
		print(0)
		print()
	else:
		a = 0
		if x & 1:
			a = 1
			x += a
		x >>= 1
		y ^= a
		if x > y:
			k = 1 << len(bin(x)[2:]) + 1
			a += k
			x += k >> 1
			y ^= k
		if x == y:
			print(1)
			print(a)
		else:
			b = y - x
			print(3)
			print(a, b, b)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	s = a[0] + 0
	xs = a[0] + 0
	for i in range(n - 1):
		s += a[i + 1]
		xs ^= a[i + 1]
	if s == 2 * xs:
		print(0)
		print()
	else:
		res = []
		res.append(xs)
		s += xs
		xs ^= xs
		res.append(s)
		xs ^= s
		s += s
		print(len(res))
		print(*res)


import sys
try:
	t = int(input())
	for _ in range(t):
		n = map(int, input().split())
		l = [int(x) for x in input().split()]
		xor = 0
		for x in l:
			xor ^= x
		print(2)
		print(xor, xor + sum(l))
except EOFError:
	pass


t = int(input(''))
mat = []
for i in range(t):
	input('')
	mat.append(list(map(int, input().split())))
for i in range(t):
	y = mat[i]
	s = sum(y)
	x = 0
	for i in range(len(y)):
		x = x ^ y[i]
	print(2)
	print(x, s + x)


for k in range(int(input())):
	n = int(input())
	ar = [int(x) for x in input().split()]
	S = 0
	X = 0
	for p in ar:
		S += p
		X ^= p
	print(2)
	print(X, X + S)


def stats(a):
	(x, s) = (0, 0)
	for v in a:
		x ^= v
		s += v
	return (x, s)
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(x, s) = stats(a)
	print(2)
	print(x, s + x)


def makeitgood(n, ll):
	sum = 0
	cishu = 0
	tmp = 0
	resultarray = []
	for i in range(0, n):
		sum = sum + ll[i]
		tmp = tmp ^ ll[i]
	if sum == 2 * tmp:
		return (0, None)
	if sum % 2 != 0:
		app = 4 * sum + 1
		resultarray.append(app)
		tmp = tmp ^ app
		sum = sum + app
		cishu = cishu + 1
	else:
		app = 4 * sum
		resultarray.append(app)
		tmp = tmp ^ app
		sum = sum + app
		cishu = cishu + 1
	if sum == 2 * tmp:
		return (cishu, resultarray)
	else:
		cha = int((2 * tmp - sum) / 2)
		resultarray.append(cha)
		resultarray.append(cha)
		cishu = cishu + 2
		return (cishu, resultarray)
tests = int(input())
for i in range(0, tests):
	numberlen = int(input())
	numbers = input().split()
	numberss = list(map(int, numbers))
	(elementnumber, elements) = makeitgood(numberlen, numberss)
	print(elementnumber)
	if elements == None:
		print(' ')
	else:
		for e in range(0, len(elements)):
			if e == len(elements) - 1:
				print(elements[e])
			else:
				print(elements[e], end=' ')


t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	ar = list(map(int, input().split()))
	s = sum(ar)
	ele = 0
	for it in ar:
		ele ^= it
	s += ele
	print('2\n{0} {1}'.format(ele, s))


t = int(input())
for test_case in range(t):
	n = int(input())
	a = [int(j) for j in input().split()]
	s = sum(a)
	XOR = 0
	for i in a:
		XOR ^= i
	print(2)
	print(XOR, s + XOR)


import sys, math

def input():
	return sys.stdin.readline()[:-1]

def main():
	q = int(input())
	for _ in range(q):
		n = int(input())
		a = list(map(int, input().split()))
		t = 0
		for e in a:
			t ^= e
		print(2)
		print(t, sum(a) + t)
main()


for _ in range(int(input())):
	n = int(input())
	array = list(map(int, input().split()))
	xor_sum = 0
	s = 0
	for i in range(n):
		xor_sum ^= array[i]
		s += array[i]
	print(2)
	print(xor_sum, s + xor_sum)


test = int(input())
while test > 0:
	test -= 1
	n = int(input())
	a = list(map(int, input().split()))
	sum = 0
	xor = 0
	for i in range(n):
		sum += a[i]
		xor = xor ^ a[i]
	print(2)
	print(xor, sum + xor)


import sys
import math
t = 1
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, sys.stdin.readline().strip().split()))
	s = sum(a)
	a.append(s * 3)
	zz = s * 3
	s += s * 3
	x = 0
	for j in a:
		x = x ^ j
	z = (2 * x - s) // 2
	a.append(z)
	a.append(z)
	s = sum(a)
	x = 0
	for j in a:
		x = x ^ j
	print(3)
	print(z, z, zz)


t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	x = a[0]
	s = a[0]
	y = z = 0
	for i in range(1, n):
		s += a[i]
		x = x ^ a[i]
	if s == 2 * x:
		print(0)
		print()
	elif s % 2 == 0 and s == x:
		y = z = int(s / 2)
		print(2)
		print(y, z)
	else:
		y = x
		z = x + s
		print(2)
		print(y, z)


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()
	res = 0
	for i in a:
		res ^= i
	if sum(a) == 2 * res:
		print(0)
		print()
	else:
		print(2)
		print(res, sum(a) + res)