#include<bits/stdc++.h>usingnamespacestd;voidsolve(vector<int>&a){intn=a.size();sort(a.begin(),a.end());intmin_element=a.front();intmax_element=a.back();intoperation_count=0;vector<int>choosen_x;while(min_element!=max_element){operation_count++;intx;// Case similar to [3, 5]
// If you add zero, it goes to [1, 2]
// If you add one, it goes to [2, 3]
if(min_element%2==1&&max_element%2==1){x=0;}// Case similar to [4, 6]
// If you add zero, it goes to [2, 3]
// If you add one, it goes to [2, 3]
if(min_element%2==0&&max_element%2==0){x=0;}// Case similar to [3, 4]
// If you add zero, it goes to [1, 2]
// If you add one, it goes to [2, 2]
if(min_element%2==1&&max_element%2==0){x=1;}// Case similar to [4, 5]
// If you add zero, it goes to [2, 2]
// If you add one, it goes to [2, 3]
if(min_element%2==0&&max_element%2==1){x=0;}min_element=(min_element+x)/2;max_element=(max_element+x)/2;choosen_x.push_back(x);}cout<<operation_count<<endl;if(operation_count>0&&operation_count<=n){for(inti=0;i<(int)choosen_x.size();i++){cout<<choosen_x[i]<<" ";}cout<<"\n";}}intmain(){intt;cin>>t;for(intzz=0;zz<t;zz++){intn;cin>>n;vector<int>a(n);for(inti=0;i<n;i++){cin>>a[i];}solve(a);}return0;}