#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define db double
#define str string
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define rall(v) rbegin(v),rend(v)
#define see(x) cout<<(#x)<<" -> "<<(x)<<"\n"
#define selp(a) for(auto i:a)cout<<i<<" ";cout<<nl;
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define fr(a,b) for(int i=a;i<b;i++)
#define frv(v) for(int i=0;i<_sz(v);i++)
#define fr1(b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
    nimble;
    int tt=1;cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        vector<ll> a(n);
        ll s=0;
        ll x=0;
        frv(a){cin>>a[i];s+=a[i];x=x^a[i];}
        if(x==0){
            cout<<1<<nl;
            cout<<s<<nl;
            continue;
        }
        if(s==2*x){
            cout<<0<<nl;
            cout<<nl;
            continue;
        }
        ll tmp=1000000000*100000000;
        if(s>2*x){
     /*       if(s&1){
                cout<<3<<nl;
                ll xxxx=(tmp+1ll)^x;
                cout<<xxxx<<" ";
                s+=(tmp+1ll)^x;
                x^=((tmp+1ll)^x);
                cout<<abs(2*x-s)/2<<" "<<abs(2*x-s)/2<<nl;
                continue;
            }*/
            cout<<3<<nl;
            ll xxxx=(tmp)^x;
            cout<<xxxx<<" ";
            s+=(tmp)^x;
            x^=((tmp)^x);
            cout<<abs(2*x-s)/2<<" "<<abs(2*x-s)/2<<nl;
            continue;
        }
        if(s&1){
            s+=1;
            x=x^1;
            if(x==0){
                cout<<2<<nl;
                cout<<1<<" "<<s<<nl;
                continue;
            }
            if(s==2*x){
                cout<<1<<nl;
                cout<<1<<nl;
                continue;
            }
            if(s<2*x){
                cout<<3<<nl;
                cout<<1<<" "<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
                continue;
            }
        }
        if(s<2*x){
            cout<<2<<nl;
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
        cout<<"PLS HACK MY CODE XD..."<<nl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define db double
#define str string
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define rall(v) rbegin(v),rend(v)
#define see(x) cout<<(#x)<<" -> "<<(x)<<"\n"
#define selp(a) for(auto i:a)cout<<i<<" ";cout<<nl;
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define fr(a,b) for(int i=a;i<b;i++)
#define frv(v) for(int i=0;i<_sz(v);i++)
#define fr1(b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
    nimble;
    int tt=1;cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        vector<ll> a(n);
        ll s=0;
        ll x=0;
        frv(a){cin>>a[i];s+=a[i];x=x^a[i];}
        while(s>2*x){
            s+=x<<1;
            x^=(2*(x<<1));
            if(x==0){
                break;
            }
        }
        if(x==0){
            cout<<1<<nl;
            cout<<s<<nl;
            continue;
        }
        if(s==2*x){
            cout<<0<<nl;
            cout<<nl;
            continue;
        }
        if(s&1){
            s+=1;
            x=x^1;
        }
        if(s<2*x){
            cout<<3<<nl;
            cout<<1<<" "<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define db double
#define str string
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define rall(v) rbegin(v),rend(v)
#define see(x) cout<<(#x)<<" -> "<<(x)<<"\n"
#define selp(a) for(auto i:a)cout<<i<<" ";cout<<nl;
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define fr(a,b) for(int i=a;i<b;i++)
#define frv(v) for(int i=0;i<_sz(v);i++)
#define fr1(b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
    nimble;
    int tt=1;cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        vector<ll> a(n);
        ll s=0;
        ll x=0;
        frv(a){cin>>a[i];s+=a[i];x=x^a[i];}
        if(x==0){
            cout<<1<<nl;
            cout<<s<<nl;
            continue;
        }
        if(s==2*x){
            cout<<0<<nl;
            cout<<nl;
            continue;
        }
        if(s>2*x){
            if(s&1){
                cout<<3<<nl;
                cout<<1000000000*x+1<<" ";
                s+=1000000000*x+1;
                x^=(1000000000*x+1);
                cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
                continue;
            }
            cout<<3<<nl;
            cout<<1000000000*x<<" ";
            s+=1000000000*x;
            x^=(1000000000*x);
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
        if(s&1){
            s+=1;
            x=x^1;
            if(s<2*x){
                cout<<3<<nl;
                cout<<1<<" "<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
                continue;
            }
        }
        if(s<2*x){
            cout<<2<<nl;
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
        cout<<"PLS HACK MY CODE XD..."<<nl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define db double
#define str string
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define rall(v) rbegin(v),rend(v)
#define see(x) cout<<(#x)<<" -> "<<(x)<<"\n"
#define selp(a) for(auto i:a)cout<<i<<" ";cout<<nl;
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define fr(a,b) for(int i=a;i<b;i++)
#define frv(v) for(int i=0;i<_sz(v);i++)
#define fr1(b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
    nimble;
    int tt=1;cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        vector<ll> a(n);
        ll s=0;
        ll x=0;
        frv(a){cin>>a[i];s+=a[i];x=x^a[i];}
        if(x==0){
            cout<<1<<nl;
            cout<<s<<nl;
            continue;
        }
        if(s==2*x){
            cout<<0<<nl;
            cout<<nl;
            continue;
        }
        ll tmp=1000000000*100000000;
        if(s>2*x){
            if(s&1){
                cout<<3<<nl;
                ll xxxx=(tmp+1ll);
                cout<<xxxx<<" ";
                s+=(tmp+1ll);
                x^=(tmp+1ll);
                cout<<abs(2*x-s)/2<<" "<<abs(2*x-s)/2<<nl;
                continue;
            }
            cout<<3<<nl;
            ll xxxx=(tmp);
            cout<<xxxx<<" ";
            s+=(tmp);
            x^=(tmp);
            cout<<abs(2*x-s)/2<<" "<<abs(2*x-s)/2<<nl;
            continue;
        }
        if(s&1){
            s+=1;
            x=x^1;
            if(x==0){
                cout<<2<<nl;
                cout<<1<<" "<<s<<nl;
                continue;
            }
            if(s==2*x){
                cout<<1<<nl;
                cout<<1<<nl;
                continue;
            }
            if(s<2*x){
                cout<<3<<nl;
                cout<<1<<" "<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
                continue;
            }
            cout<<3<<nl;
            cout<<1<<" "<<x<<" "<<s+x<<nl;
            continue;
        }
        if(s<2*x){
            cout<<2<<nl;
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
        cout<<"PLS HACK MY CODE XD..."<<nl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define db double
#define str string
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define rall(v) rbegin(v),rend(v)
#define see(x) cout<<(#x)<<" -> "<<(x)<<"\n"
#define selp(a) for(auto i:a)cout<<i<<" ";cout<<nl;
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define fr(a,b) for(int i=a;i<b;i++)
#define frv(v) for(int i=0;i<_sz(v);i++)
#define fr1(b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
    nimble;
    int tt=1;cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        vector<ll> a(n);
        ll s=0;
        ll x=0;
        frv(a){cin>>a[i];s+=a[i];x=x^a[i];}
        cout<<2<<nl;
        cout<<x<<" "<<s+x<<nl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define db double
#define str string
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define rall(v) rbegin(v),rend(v)
#define see(x) cout<<(#x)<<" -> "<<(x)<<"\n"
#define selp(a) for(auto i:a)cout<<i<<" ";cout<<nl;
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define fr(a,b) for(int i=a;i<b;i++)
#define frv(v) for(int i=0;i<_sz(v);i++)
#define fr1(b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
    nimble;
    int tt=1;cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        vector<ll> a(n);
        ll s=0;
        ll x=0;
        frv(a){cin>>a[i];s+=a[i];x=x^a[i];}
        if(x==0){
            cout<<1<<nl;
            cout<<s<<nl;
            continue;
        }
        if(s==2*x){
            cout<<0<<nl;
            cout<<nl;
            continue;
        }
        if(s&1){
            s+=1;
            x=x^1;
            if(s<2*x){
                cout<<3<<nl;
                cout<<1<<" "<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
                continue;
            }
            cout<<3<<nl;
            cout<<100000000*x<<" ";
            s+=100000000*x;
            x^=(100000000*x);
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
        if(s<2*x){
            cout<<2<<nl;
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
        cout<<3<<nl;
        cout<<100000000*x<<" ";
        s+=100000000*x;
        x^=(100000000*x);
        cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
        continue;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define db double
#define str string
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define rall(v) rbegin(v),rend(v)
#define see(x) cout<<(#x)<<" -> "<<(x)<<"\n"
#define selp(a) for(auto i:a)cout<<i<<" ";cout<<nl;
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define fr(a,b) for(int i=a;i<b;i++)
#define frv(v) for(int i=0;i<_sz(v);i++)
#define fr1(b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
    nimble;
    int tt=1;cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        vector<ll> a(n);
        ll s=0;
        ll x=0;
        frv(a){cin>>a[i];s+=a[i];x=x^a[i];}
        if(x==0){
            cout<<1<<nl;
            cout<<s<<nl;
            continue;
        }
        if(s==2*x){
            cout<<0<<nl;
            cout<<nl;
            continue;
        }
        ll tmp=1000000000*1000000000;
        tmp/=x;
        if(s>2*x){
            if(s&1){
                cout<<3<<nl;
                cout<<1ll*(tmp*x+1ll)<<" ";
                s+=1ll*(tmp*x+1ll);
                x^=(1ll*tmp*x+1ll);
                cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
                continue;
            }
            cout<<3<<nl;
            cout<<1ll*tmp*x<<" ";
            s+=1ll*tmp*x;
            x^=(1ll*tmp*x);
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
        if(s&1){
            s+=1;
            x=x^1;
            if(x==0){
                cout<<2<<nl;
                cout<<1<<" "<<s<<nl;
                continue;
            }
            if(s==2*x){
                cout<<1<<nl;
                cout<<1<<nl;
                continue;
            }
            if(s<2*x){
                cout<<3<<nl;
                cout<<1<<" "<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
                continue;
            }
        }
        if(s<2*x){
            cout<<2<<nl;
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
        cout<<"PLS HACK MY CODE XD..."<<nl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define db double
#define str string
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define rall(v) rbegin(v),rend(v)
#define see(x) cout<<(#x)<<" -> "<<(x)<<"\n"
#define selp(a) for(auto i:a)cout<<i<<" ";cout<<nl;
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define fr(a,b) for(int i=a;i<b;i++)
#define frv(v) for(int i=0;i<_sz(v);i++)
#define fr1(b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
    nimble;
    int tt=1;cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        vector<ll> a(n);
        ll s=0;
        ll x=0;
        frv(a){cin>>a[i];s+=a[i];x=x^a[i];}
        while(s>2*x){
            s+=x<<1;
            x^=(x<<1);
            if(x==0){
                break;
            }
        }
        if(x==0){
            cout<<1<<nl;
            cout<<s<<nl;
            continue;
        }
        if(s==2*x){
            cout<<0<<nl;
            cout<<nl;
            continue;
        }
        if(s&1){
            s+=1;
            x=x^1;
            if(s<2*x){
                cout<<3<<nl;
                cout<<1<<" "<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
                continue;
            }
        }
        if(s<2*x){
            cout<<2<<nl;
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define db double
#define str string
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define rall(v) rbegin(v),rend(v)
#define see(x) cout<<(#x)<<" -> "<<(x)<<"\n"
#define selp(a) for(auto i:a)cout<<i<<" ";cout<<nl;
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define fr(a,b) for(int i=a;i<b;i++)
#define frv(v) for(int i=0;i<_sz(v);i++)
#define fr1(b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
    nimble;
    int tt=1;cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        vector<ll> a(n);
        ll s=0;
        ll x=0;
        frv(a){cin>>a[i];s+=a[i];x=x^a[i];}
        if(x==0){
            cout<<1<<nl;
            cout<<s<<nl;
            continue;
        }
        if(s==2*x){
            cout<<0<<nl;
            cout<<nl;
            continue;
        }
        ll tmp=1000000000*100000000;
        if(s>2*x){
           if(s&1){
                cout<<3<<nl;
                ll xxxx=(tmp+1ll)^x;
                cout<<xxxx<<" ";
                s+=(tmp+1ll)^x;
                x^=((tmp+1ll)^x);
                cout<<abs(2*x-s)/2<<" "<<abs(2*x-s)/2<<nl;
                continue;
            }
            cout<<3<<nl;
            ll xxxx=(tmp)^x;
            cout<<xxxx<<" ";
            s+=(tmp)^x;
            x^=((tmp)^x);
            cout<<abs(2*x-s)/2<<" "<<abs(2*x-s)/2<<nl;
            continue;
        }
        if(s&1){
            s+=1;
            x=x^1;
            if(x==0){
                cout<<2<<nl;
                cout<<1<<" "<<s<<nl;
                continue;
            }
            if(s==2*x){
                cout<<1<<nl;
                cout<<1<<nl;
                continue;
            }
            if(s<2*x){
                cout<<3<<nl;
                cout<<1<<" "<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
                continue;
            }
        }
        if(s<2*x){
            cout<<2<<nl;
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
        tmp=1000000000*100000000;
        if(s>2*x){
           if(s&1){
                cout<<3<<nl;
                ll xxxx=(tmp+1ll)^x;
                cout<<xxxx<<" ";
                s+=(tmp+1ll)^x;
                x^=((tmp+1ll)^x);
                cout<<abs(2*x-s)/2<<" "<<abs(2*x-s)/2<<nl;
                continue;
            }
            cout<<3<<nl;
            ll xxxx=(tmp)^x;
            cout<<xxxx<<" ";
            s+=(tmp)^x;
            x^=((tmp)^x);
            cout<<abs(2*x-s)/2<<" "<<abs(2*x-s)/2<<nl;
            continue;
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define db double
#define str string
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define rall(v) rbegin(v),rend(v)
#define see(x) cout<<(#x)<<" -> "<<(x)<<"\n"
#define selp(a) for(auto i:a)cout<<i<<" ";cout<<nl;
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define fr(a,b) for(int i=a;i<b;i++)
#define frv(v) for(int i=0;i<_sz(v);i++)
#define fr1(b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
    nimble;
    int tt=1;cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        vector<ll> a(n);
        ll s=0;
        ll x=0;
        frv(a){cin>>a[i];s+=a[i];x=x^a[i];}
        if(x==0){
            cout<<1<<nl;
            cout<<s<<nl;
            continue;
        }
        if(s==2*x){
            cout<<0<<nl;
            cout<<nl;
            continue;
        }
        ll tmp=1000000000*100000000;
        if(s>2*x){
            if(s&1){
                cout<<3<<nl;
                ll xxxx=(tmp+1ll)^x;
                cout<<xxxx<<" ";
                s+=(tmp+1ll)^x;
                x^=((tmp+1ll)^x);
                cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
                continue;
            }
            cout<<3<<nl;
            ll xxxx=(tmp)^x;
            cout<<xxxx<<" ";
            s+=(tmp)^x;
            x^=((tmp)^x);
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
        if(s&1){
            s+=1;
            x=x^1;
            if(x==0){
                cout<<2<<nl;
                cout<<1<<" "<<s<<nl;
                continue;
            }
            if(s==2*x){
                cout<<1<<nl;
                cout<<1<<nl;
                continue;
            }
            if(s<2*x){
                cout<<3<<nl;
                cout<<1<<" "<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
                continue;
            }
        }
        if(s<2*x){
            cout<<2<<nl;
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
        cout<<"PLS HACK MY CODE XD..."<<nl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define db double
#define str string
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define rall(v) rbegin(v),rend(v)
#define see(x) cout<<(#x)<<" -> "<<(x)<<"\n"
#define selp(a) for(auto i:a)cout<<i<<" ";cout<<nl;
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define fr(a,b) for(int i=a;i<b;i++)
#define frv(v) for(int i=0;i<_sz(v);i++)
#define fr1(b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
    nimble;
    int tt=1;cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        vector<ll> a(n);
        ll s=0;
        ll x=0;
        frv(a){cin>>a[i];s+=a[i];x=x^a[i];}
        if(x==0){
            cout<<1<<nl;
            cout<<s<<nl;
            continue;
        }
        if(s==2*x){
            cout<<0<<nl;
            cout<<nl;
            continue;
        }
        ll tmp=(ll)1000000000*100000000;
        if(s>2*x){
            if(s&1){
                cout<<3<<nl;
                ll xxxx=(tmp+1ll);
                cout<<xxxx<<" ";
                s+=(tmp+1ll);
                x^=(tmp+1ll);
                cout<<abs(2*x-s)/2<<" "<<abs(2*x-s)/2<<nl;
                continue;
            }
            cout<<3<<nl;
            ll xxxx=(tmp);
            cout<<xxxx<<" ";
            s+=(tmp);
            x^=(tmp);
            cout<<abs(2*x-s)/2<<" "<<abs(2*x-s)/2<<nl;
            continue;
        }
        if(s&1){
            s+=1;
            x=x^1;
            if(x==0){
                cout<<2<<nl;
                cout<<1<<" "<<s<<nl;
                continue;
            }
            if(s==2*x){
                cout<<1<<nl;
                cout<<1<<nl;
                continue;
            }
            if(s<2*x){
                cout<<3<<nl;
                cout<<1<<" "<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
                continue;
            }
            cout<<3<<nl;
            cout<<1<<" "<<x<<" "<<s+x<<nl;
            continue;
        }
        if(s<2*x){
            cout<<2<<nl;
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
        cout<<"PLS HACK MY CODE XD..."<<nl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define db double
#define str string
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define rall(v) rbegin(v),rend(v)
#define see(x) cout<<(#x)<<" -> "<<(x)<<"\n"
#define selp(a) for(auto i:a)cout<<i<<" ";cout<<nl;
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define fr(a,b) for(int i=a;i<b;i++)
#define frv(v) for(int i=0;i<_sz(v);i++)
#define fr1(b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
    nimble;
    int tt=1;cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        vector<ll> a(n);
        ll s=0;
        ll x=0;
        frv(a){cin>>a[i];s+=a[i];x=x^a[i];}
        if(x==0){
            cout<<1<<nl;
            cout<<s<<nl;
            continue;
        }
        if(s==2*x){
            cout<<0<<nl;
            cout<<nl;
            continue;
        }
        ll tmp=1000000000*1000000000;
        tmp/=x;
        if(s>2*x){
            if(s&1){
                cout<<3<<nl;
                cout<<1ll*(tmp*x+1ll)<<" ";
                s+=1ll*(tmp*x+1ll);
                x^=(1ll*tmp*x+1ll);
                cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
                continue;
            }
            cout<<3<<nl;
            cout<<1ll*tmp*x<<" ";
            s+=1ll*tmp*x;
            x^=(1ll*tmp*x);
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
        if(s&1){
            s+=1;
            x=x^1;
            if(x==0){
                cout<<2<<nl;
                cout<<1<<" "<<s<<nl;
                continue;
            }
            if(s<2*x){
                cout<<3<<nl;
                cout<<1<<" "<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
                continue;
            }
        }
        if(s<2*x){
            cout<<2<<nl;
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
        cout<<"PLS HACK MY CODE XD..."<<nl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define db double
#define str string
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define rall(v) rbegin(v),rend(v)
#define see(x) cout<<(#x)<<" -> "<<(x)<<"\n"
#define selp(a) for(auto i:a)cout<<i<<" ";cout<<nl;
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define fr(a,b) for(int i=a;i<b;i++)
#define frv(v) for(int i=0;i<_sz(v);i++)
#define fr1(b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
    nimble;
    int tt=1;cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        vector<ll> a(n);
        ll s=0;
        ll x=0;
        frv(a){cin>>a[i];s+=a[i];x=x^a[i];}
        if(x==0){
            cout<<1<<nl;
            cout<<s<<nl;
            continue;
        }
        if(s==2*x){
            cout<<0<<nl;
            cout<<nl;
            continue;
        }
        ll tmp=1ll*1000000000*1ll*100000000;
        if(s>2*x){
           if(s&1){
                cout<<3<<nl;
                ll xxxx=(tmp+1ll)^x;
                cout<<xxxx<<" ";
                s+=(tmp+1ll)^x;
                x^=((tmp+1ll)^x);
                cout<<abs(2*x-s)/2<<" "<<abs(2*x-s)/2<<nl;
                continue;
            }
            cout<<3<<nl;
            ll xxxx=(tmp)^x;
            cout<<xxxx<<" ";
            s+=(tmp)^x;
            x^=((tmp)^x);
            cout<<abs(2*x-s)/2<<" "<<abs(2*x-s)/2<<nl;
            continue;
        }
        if(s&1){
            s+=1;
            x=x^1;
            if(x==0){
                cout<<2<<nl;
                cout<<1<<" "<<s<<nl;
                continue;
            }
            if(s==2*x){
                cout<<1<<nl;
                cout<<1<<nl;
                continue;
            }
            if(s<2*x){
                cout<<3<<nl;
                cout<<1<<" "<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
                continue;
            }
        }
        if(s<2*x){
            cout<<2<<nl;
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define db double
#define str string
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define rall(v) rbegin(v),rend(v)
#define see(x) cout<<(#x)<<" -> "<<(x)<<"\n"
#define selp(a) for(auto i:a)cout<<i<<" ";cout<<nl;
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define fr(a,b) for(int i=a;i<b;i++)
#define frv(v) for(int i=0;i<_sz(v);i++)
#define fr1(b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
    nimble;
    int tt=1;cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        vector<ll> a(n);
        ll s=0;
        ll x=0;
        frv(a){cin>>a[i];s+=a[i];x=x^a[i];}
        if(x==0){
            cout<<1<<nl;
            cout<<s<<nl;
            continue;
        }
        if(s==2*x){
            cout<<0<<nl;
            cout<<nl;
            continue;
        }
        ll tmp=1ll*1000000000*1ll*100000000;
           if(s&1){
                cout<<3<<nl;
                ll xxxx=(tmp+1ll)^x;
                cout<<xxxx<<" ";
                s+=(tmp+1ll)^x;
                x^=((tmp+1ll)^x);
                cout<<abs(2*x-s)/2<<" "<<abs(2*x-s)/2<<nl;
                continue;
            }
            cout<<3<<nl;
            ll xxxx=(tmp)^x;
            cout<<xxxx<<" ";
            s+=(tmp)^x;
            x^=((tmp)^x);
            cout<<abs(2*x-s)/2<<" "<<abs(2*x-s)/2<<nl;
            continue;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define db double
#define str string
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define rall(v) rbegin(v),rend(v)
#define see(x) cout<<(#x)<<" -> "<<(x)<<"\n"
#define selp(a) for(auto i:a)cout<<i<<" ";cout<<nl;
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define fr(a,b) for(int i=a;i<b;i++)
#define frv(v) for(int i=0;i<_sz(v);i++)
#define fr1(b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
    nimble;
    int tt=1;cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        vector<ll> a(n);
        ll s=0;
        ll x=0;
        frv(a){cin>>a[i];s+=a[i];x=x^a[i];}
        while(s>2*x){
            s+=x<<1;
            x^=(2*(x<<1));
            if(x==0){
                break;
            }
        }
        if(x==0){
            cout<<1<<nl;
            cout<<s<<nl;
            continue;
        }
        if(s==2*x){
            cout<<0<<nl;
            cout<<nl;
            continue;
        }
        if(s&1){
            s+=1;
            x=x^1;
            if(s<2*x){
                cout<<3<<nl;
                cout<<1<<" "<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
                continue;
            }
        }
        if(s<2*x){
            cout<<2<<nl;
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define db double
#define str string
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define rall(v) rbegin(v),rend(v)
#define see(x) cout<<(#x)<<" -> "<<(x)<<"\n"
#define selp(a) for(auto i:a)cout<<i<<" ";cout<<nl;
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define fr(a,b) for(int i=a;i<b;i++)
#define frv(v) for(int i=0;i<_sz(v);i++)
#define fr1(b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
    nimble;
    int tt=1;cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        vector<ll> a(n);
        ll s=0;
        ll x=0;
        frv(a){cin>>a[i];s+=a[i];x=x^a[i];}
        if(s==2*x){
            cout<<0<<nl;
            cout<<nl;
            continue;
        }
        if(s>2*x){
            cout<<3<<nl;
            cout<<100000000*x<<" ";
            s+=100000000*x;
            x^=(100000000*x);
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
        if(s&1){
            s+=1;
            x=x^1;
            if(s<2*x){
                cout<<3<<nl;
                cout<<1<<" "<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
                continue;
            }
        }
        if(s<2*x){
            cout<<2<<nl;
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define db double
#define str string
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define rall(v) rbegin(v),rend(v)
#define see(x) cout<<(#x)<<" -> "<<(x)<<"\n"
#define selp(a) for(auto i:a)cout<<i<<" ";cout<<nl;
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define fr(a,b) for(int i=a;i<b;i++)
#define frv(v) for(int i=0;i<_sz(v);i++)
#define fr1(b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
    nimble;
    int tt=1;cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        vector<ll> a(n);
        ll s=0;
        ll x=0;
        frv(a){cin>>a[i];s+=a[i];x=x^a[i];}
        if(x==0){
            cout<<1<<nl;
            cout<<s<<nl;
            continue;
        }
        if(s==2*x){
            cout<<0<<nl;
            cout<<nl;
            continue;
        }
        ll tmp=1000000000*1000000000;
        tmp/=x;
        if(s>2*x){
            if(s&1){
                cout<<3<<nl;
                cout<<1ll*(tmp*x+1ll)<<" ";
                s+=1ll*(tmp*x+1ll);
                x^=(1ll*tmp*x+1ll);
                cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
                continue;
            }
            cout<<3<<nl;
            cout<<1ll*tmp*x<<" ";
            s+=1ll*tmp*x;
            x^=(1ll*tmp*x);
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
        if(s&1){
            s+=1;
            x=x^1;
            if(x==0){
                cout<<2<<nl;
                cout<<2<<" "<<s<<nl;
                continue;
            }
            if(s<2*x){
                cout<<3<<nl;
                cout<<1<<" "<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
                continue;
            }
        }
        if(s<2*x){
            cout<<2<<nl;
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
        cout<<"PLS HACK MY CODE XD..."<<nl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define db double
#define str string
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define rall(v) rbegin(v),rend(v)
#define see(x) cout<<(#x)<<" -> "<<(x)<<"\n"
#define selp(a) for(auto i:a)cout<<i<<" ";cout<<nl;
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define fr(a,b) for(int i=a;i<b;i++)
#define frv(v) for(int i=0;i<_sz(v);i++)
#define fr1(b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
    nimble;
    int tt=1;cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        vector<ll> a(n);
        ll s=0;
        ll x=0;
        frv(a){cin>>a[i];s+=a[i];x=x^a[i];}
        if(x==0){
            cout<<1<<nl;
            cout<<s<<nl;
            continue;
        }
        if(s==2*x){
            cout<<0<<nl;
            cout<<nl;
            continue;
        }
        ll tmp=1000000000*1000000000;
        tmp/=x;
        if(s>2*x){
            if(s&1){
                cout<<3<<nl;
                cout<<1ll*(tmp*x+1ll)<<" ";
                s+=1ll*(tmp*x+1ll);
                x^=(1ll*tmp*x+1ll);
                cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
                continue;
            }
            cout<<3<<nl;
            cout<<1ll*tmp*x<<" ";
            s+=1ll*tmp*x;
            x^=(1ll*tmp*x);
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
        if(s&1){
            s+=1;
            x=x^1;
            if(x==0){
                cout<<1<<nl;
                cout<<s<<nl;
                continue;
            }
            if(s<2*x){
                cout<<3<<nl;
                cout<<1<<" "<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
                continue;
            }
        }
        if(s<2*x){
            cout<<2<<nl;
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
        cout<<"PLS HACK MY CODE XD..."<<nl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define db double
#define str string
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define rall(v) rbegin(v),rend(v)
#define see(x) cout<<(#x)<<" -> "<<(x)<<"\n"
#define selp(a) for(auto i:a)cout<<i<<" ";cout<<nl;
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define fr(a,b) for(int i=a;i<b;i++)
#define frv(v) for(int i=0;i<_sz(v);i++)
#define fr1(b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
    nimble;
    int tt=1;cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        vector<ll> a(n);
        ll s=0;
        ll x=0;
        frv(a){cin>>a[i];s+=a[i];x=x^a[i];}
        if(x==0){
            cout<<1<<nl;
            cout<<s<<nl;
            continue;
        }
        if(s==2*x){
            cout<<0<<nl;
            cout<<nl;
            continue;
        }
        ll tmp=(ll)1000000000*100000000;
        if(s>2*x){
            if(s&1){
                cout<<3<<nl;
                ll xxxx=(tmp+1ll);
                cout<<xxxx<<" ";
                s+=(tmp+1ll);
                x^=(tmp+1ll);
                cout<<abs(2*x-s)/2<<" "<<abs(2*x-s)/2<<nl;
                continue;
            }
            cout<<3<<nl;
            ll xxxx=(tmp);
            cout<<xxxx<<" ";
            s+=(tmp);
            x^=(tmp);
            cout<<abs(2*x-s)/2<<" "<<abs(2*x-s)/2<<nl;
            continue;
        }
        if(s&1){
            s+=1;
            x=x^1;
            if(x==0){
                cout<<2<<nl;
                cout<<1<<" "<<s<<nl;
                continue;
            }
            if(s==2*x){
                cout<<1<<nl;
                cout<<1<<nl;
                continue;
            }
            if(s<2*x){
                cout<<3<<nl;
                cout<<1<<" "<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
                continue;
            }
        }
        if(s<2*x){
            cout<<2<<nl;
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
        cout<<"PLS HACK MY CODE XD..."<<nl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define db double
#define str string
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define rall(v) rbegin(v),rend(v)
#define see(x) cout<<(#x)<<" -> "<<(x)<<"\n"
#define selp(a) for(auto i:a)cout<<i<<" ";cout<<nl;
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define fr(a,b) for(int i=a;i<b;i++)
#define frv(v) for(int i=0;i<_sz(v);i++)
#define fr1(b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
    nimble;
    int tt=1;cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        vector<ll> a(n);
        ll s=0;
        ll x=0;
        frv(a){cin>>a[i];s+=a[i];x=x^a[i];}
        if(s==2*x){
            cout<<0<<nl;
            continue;
        }
        if(s&1){
            s+=1;
            x=x^1;
        }
        if(s<2*x){
            cout<<3<<nl;
            cout<<1<<" "<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }

    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define db double
#define str string
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define rall(v) rbegin(v),rend(v)
#define see(x) cout<<(#x)<<" -> "<<(x)<<"\n"
#define selp(a) for(auto i:a)cout<<i<<" ";cout<<nl;
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define fr(a,b) for(int i=a;i<b;i++)
#define frv(v) for(int i=0;i<_sz(v);i++)
#define fr1(b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
    nimble;
    int tt=1;cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        vector<ll> a(n);
        ll s=0;
        ll x=0;
        frv(a){cin>>a[i];s+=a[i];x=x^a[i];}
        if(x==0){
            cout<<1<<nl;
            cout<<s<<nl;
            continue;
        }
        if(s==2*x){
            cout<<0<<nl;
            cout<<nl;
            continue;
        }
        if(s>2*x){
            if(s&1){
                cout<<3<<nl;
                cout<<1000000*x+1<<" ";
                s+=1000000*x+1;
                x^=(1000000*x+1);
                cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
                continue;
            }
            cout<<3<<nl;
            cout<<1000000*x<<" ";
            s+=1000000*x;
            x^=(1000000*x);
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
        if(s&1){
            s+=1;
            x=x^1;
            if(s<2*x){
                cout<<3<<nl;
                cout<<1<<" "<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
                continue;
            }
        }
        if(s<2*x){
            cout<<2<<nl;
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
        cout<<"PLS HACK MY CODE XD..."<<nl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define db double
#define str string
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define rall(v) rbegin(v),rend(v)
#define see(x) cout<<(#x)<<" -> "<<(x)<<"\n"
#define selp(a) for(auto i:a)cout<<i<<" ";cout<<nl;
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define fr(a,b) for(int i=a;i<b;i++)
#define frv(v) for(int i=0;i<_sz(v);i++)
#define fr1(b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
    nimble;
    int tt=1;cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        vector<ll> a(n);
        ll s=0;
        ll x=0;
        frv(a){cin>>a[i];s+=a[i];x=x^a[i];}
        if(x==0){
            cout<<1<<nl;
            cout<<s<<nl;
            continue;
        }
        if(s==2*x){
            cout<<0<<nl;
            cout<<nl;
            continue;
        }
        if(s>2*x){
            if(s&1){
                cout<<3<<nl;
                cout<<100000000*x+1<<" ";
                s+=100000000*x+1;
                x^=(100000000*x+1);
                cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
                continue;
            }
            cout<<3<<nl;
            cout<<100000000*x<<" ";
            s+=100000000*x;
            x^=(100000000*x);
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
        if(s&1){
            s+=1;
            x=x^1;
            if(s<2*x){
                cout<<3<<nl;
                cout<<1<<" "<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
                continue;
            }
        }
        if(s<2*x){
            cout<<2<<nl;
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
        cout<<"PLS HACK MY CODE XD..."<<nl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define db double
#define str string
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define rall(v) rbegin(v),rend(v)
#define see(x) cout<<(#x)<<" -> "<<(x)<<"\n"
#define selp(a) for(auto i:a)cout<<i<<" ";cout<<nl;
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define fr(a,b) for(int i=a;i<b;i++)
#define frv(v) for(int i=0;i<_sz(v);i++)
#define fr1(b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
    nimble;
    int tt=1;cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        vector<ll> a(n);
        ll s=0;
        ll x=0;
        frv(a){cin>>a[i];s+=a[i];x=x^a[i];}
        if(x==0){
            cout<<1<<nl;
            cout<<s<<nl;
            continue;
        }
        if(s==2*x){
            cout<<0<<nl;
            cout<<nl;
            continue;
        }
        ll tmp=1ll*1000000000*100000000;
        ll gg=tmp+s%2;
        s+=gg;
        x^=gg;
        cout<<3<<nl;
        cout<<gg<<" "<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define db double
#define str string
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define rall(v) rbegin(v),rend(v)
#define see(x) cout<<(#x)<<" -> "<<(x)<<"\n"
#define selp(a) for(auto i:a)cout<<i<<" ";cout<<nl;
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define fr(a,b) for(int i=a;i<b;i++)
#define frv(v) for(int i=0;i<_sz(v);i++)
#define fr1(b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
    nimble;
    int tt=1;cin>>tt;
    while(tt--){
        int n;
        cin>>n;
        vector<ll> a(n);
        ll s=0;
        ll x=0;
        frv(a){cin>>a[i];s+=a[i];x=x^a[i];}
        if(x==0){
            cout<<1<<nl;
            cout<<s<<nl;
            continue;
        }
        if(s==2*x){
            cout<<0<<nl;
            cout<<nl;
            continue;
        }
        if(s&1){
            s+=1;
            x=x^1;
            if(s<2*x){
                cout<<3<<nl;
                cout<<1<<" "<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
                continue;
            }
            cout<<3<<nl;
            cout<<100000000<<" ";
            s+=100000000;
            x^=100000000;
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
        if(s<2*x){
            cout<<2<<nl;
            cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
            continue;
        }
        cout<<3<<nl;
        cout<<100000000<<" ";
        s+=100000000;
        x^=100000000;
        cout<<(2*x-s)/2<<" "<<(2*x-s)/2<<nl;
        continue;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long func(long long n)
{
    int count=0;
    while(n>0)
    {
        count++;
        n=n/2;
    }
    return (1<<count);
}
int main()
{
    long long t,n,x,sum,xsum;
    cin>>t;
    while(t--)
    {
        sum=xsum=0;
        cin>>n;
        for(int i=0;i<n;i++)
        {
            cin>>x;
            sum+=x;
            xsum^=x;
        }
        if(2*xsum==sum)
            cout<<"0\n\n";
        else if(sum>(2*xsum))
        {
            //long long num=func(sum);
            long long add=func(sum);
            if(sum%2==1 && add%2==0)
                add++;
            else if(sum%2==0 && add%2==1)
                add++;
            xsum^=add;
            sum+=add;
            if(sum==2*xsum)
                cout<<"1\n"<<add<<"\n";
                else{
            cout<<"3\n";
            cout<<add<<" "<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
                }
        }
        else
        {
            if(sum%2==1) //odd
            {
                sum+=1;
                xsum^=1;
                if(sum==2*xsum)
                    cout<<"1\n1\n";
                else if(sum<2*xsum)
                {
                    cout<<"3\n";
                    cout<<"1"<<" "<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
                }
                else
                {
                    sum-=1;
                    xsum^=1;
                    long long add=func(sum);
            if(sum%2==1 && add%2==0)
                add++;
            else if(sum%2==0 && add%2==1)
                add++;
            xsum^=add;
            sum+=add;
            if(sum==2*xsum)
                cout<<"1\n"<<add<<"\n";
                else{
            cout<<"3\n";
            cout<<add<<" "<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
                }
                }
            }
            else
            {
                cout<<"2\n";
                cout<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
            }
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
long long func(long long n)
{
    int ans=0,count=0;
    while(n>0)
    {
        ans+=int(pow(2,count++));
        n=n/2;
    }
    return ans;
}
int main()
{
    long long t,n,x,sum,xsum;
    cin>>t;
    while(t--)
    {
        sum=xsum=0;
        cin>>n;
        for(int i=0;i<n;i++)
        {
            cin>>x;
            sum+=x;
            xsum^=x;
        }
        if(2*xsum==sum)
            cout<<"0\n\n";
        else if(sum>(2*xsum))
        {
            long long num=func(sum);
            long long add=num^xsum;
            if(sum%2==1 && add%2==0)
                add++;
            else if(sum%2==0 && add%2==1)
                add++;
            xsum^=add;
            sum+=add;
            if(sum==2*xsum)
                cout<<"1\n"<<add<<"\n";
                else{
            cout<<"3\n";
            cout<<add<<" "<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
                }
        }
        else
        {
            if(sum%2==1) //odd
            {
                if(sum+1==xsum)
                    cout<<"1\n1\n";
                else
                {
                    sum+=1;
                    cout<<"3\n";
                    cout<<"1"<<" "<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
                }
            }
            else
            {
                cout<<"2\n";
                cout<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
            }
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
long long func(long long n)
{
    int count=0;
    while(n>0)
    {
        count++;
        n=n/2;
    }
    return (1<<count);
}
int main()
{
    long long t,n,x,sum,xsum;
    cin>>t;
    while(t--)
    {
        sum=xsum=0;
        cin>>n;
        for(int i=0;i<n;i++)
        {
            cin>>x;
            sum+=x;
            xsum^=x;
        }
        if(2*xsum==sum)
            cout<<"0\n\n";
        else if(sum>(2*xsum))
        {
            //long long num=func(sum);
            long long add=func(sum);
            if(sum%2==1 && add%2==0)
                add++;
            else if(sum%2==0 && add%2==1)
                add++;
            xsum^=add;
            sum+=add;
            if(sum==2*xsum)
                cout<<"1\n"<<add<<"\n";
                else{
            cout<<"3\n";
            cout<<add<<" "<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
                }
        }
        else
        {
            if(sum%2==1) //odd
            {
                if(sum+1==2*xsum)
                    cout<<"1\n1\n";
                else
                {
                    sum+=1;
                    xsum^=1;
                    cout<<"3\n";
                    cout<<"1"<<" "<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
                }
            }
            else
            {
                cout<<"2\n";
                cout<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
            }
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
long long func(long long n)
{
    long long ans=0,count=0;
    ans=ans^n+n;
    //while(n>=ans)
        //ans+=int(pow(2,count++));
    return ans;
}
int main()
{
    long long t,n,x,sum,xsum;
    cin>>t;
    while(t--)
    {
        sum=xsum=0;
        cin>>n;
        for(int i=0;i<n;i++)
        {
            cin>>x;
            sum+=x;
            xsum^=x;
        }
        if(2*xsum==sum)
            cout<<"0\n\n";
        else if(sum>(2*xsum))
        {
            long long num=func(sum);
            long long add=num^xsum;
            if(sum%2==1 && add%2==0)
                add++;
            else if(sum%2==0 && add%2==1)
                add--;
            xsum^=add;
            sum+=add;
            if(sum==2*xsum)
                cout<<"1\n"<<add<<"\n";
                else{
            cout<<"3\n";
            cout<<add<<" "<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
                }
        }
        else
        {
            if(sum%2==1) //odd
            {
                sum+=1;
                xsum^=1;
                if(sum==2*xsum)
                    cout<<"1\n1\n";
                else if(sum<2*xsum)
                {
                    cout<<"3\n";
                    cout<<"1"<<" "<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
                }
                else
                {
                    sum-=1;
                    xsum^=1;
                   long long num=func(sum);
            long long add=num^xsum;
            //cout<<num<<" "<<add<<endl;
            if(sum%2==1 && add%2==0)
                add++;
            else if(sum%2==0 && add%2==1)
                add--;
            xsum^=add;
            sum+=add;
            if(sum==2*xsum)
                cout<<"1\n"<<add<<"\n";
                else{
            cout<<"3\n";
            cout<<add<<" "<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
                }
                }
            }
            else
            {
                cout<<"2\n";
                cout<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
            }
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
long long func(long long n)
{
    int ans=0,count=0;
    while(n>0)
    {
        ans+=int(pow(2,count++));
        n=n/2;
    }
    return ans;
}
int main()
{
    long long t,n,x,sum,xsum;
    cin>>t;
    while(t--)
    {
        sum=xsum=0;
        cin>>n;
        for(int i=0;i<n;i++)
        {
            cin>>x;
            sum+=x;
            xsum^=x;
        }
        if(2*xsum==sum)
            cout<<"0\n\n";
        else if(sum>(2*xsum))
        {
            long long num=func(sum);
            long long add=num^xsum;
            if(sum%2==1 && add%2==0)
                add--;
            else if(sum%2==0 && add%2==1)
                add--;
            xsum^=add;
            sum+=add;
            if(sum==2*xsum)
                cout<<"1\n"<<add<<"\n";
                else{
            cout<<"3\n";
            cout<<add<<" "<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
                }
        }
        else
        {
            if(sum%2==1) //odd
            {
                if(sum+1==2*xsum)
                    cout<<"1\n1\n";
                else
                {
                    sum+=1;
                    cout<<"3\n";
                    cout<<"1"<<" "<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
                }
            }
            else
            {
                cout<<"2\n";
                cout<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
            }
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
long long func(long long n)
{
    int ans=0,count=0;
    while(n>0)
    {
        ans+=int(pow(2,count++));
        n=n/2;
    }
    return ans;
}
int main()
{
    long long t,n,x,sum,xsum;
    cin>>t;
    while(t--)
    {
        sum=xsum=0;
        cin>>n;
        for(int i=0;i<n;i++)
        {
            cin>>x;
            sum+=x;
            xsum^=x;
        }
        if(2*xsum==sum)
            cout<<"0\n\n";
        else if(sum>(2*xsum))
        {
            long long num=func(sum);
            long long add=num^xsum;
            if(sum%2==1 && add%2==0)
                add++;
            else if(sum%2==0 && add%2==1)
                add++;
            xsum^=add;
            sum+=add;
            cout<<"3\n";
            cout<<add<<" "<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
        }
        else
        {
            if(sum%2==1) //odd
            {
                if(sum+1==xsum)
                    cout<<"1\n1\n";
                else
                {
                    sum+=1;
                    cout<<"3\n";
                    cout<<"1"<<" "<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
                }
            }
            else
            {
                cout<<"2\n";
                cout<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
            }
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
long long func(long long n)
{
    long long ans=0,count=0;
    ans=ans^n+n;
    return ans;
}
void func2(long long sum,long long xsum)
{
    long long num=func(sum);
    long long add=num^xsum;
    if(sum%2==1 && add%2==0)
        add++;
    else if(sum%2==0 && add%2==1)
        add--;
    xsum^=add;
    sum+=add;
    if(sum==2*xsum)
        cout<<"1\n"<<add<<"\n";
    else{
        cout<<"3\n";
        cout<<add<<" "<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
    }
}
int main()
{
    long long t,n,x,sum,xsum;
    cin>>t;
    while(t--)
    {
        sum=xsum=0;
        cin>>n;
        for(int i=0;i<n;i++)
        {
            cin>>x;
            sum+=x;
            xsum^=x;
        }
        if(2*xsum==sum)
            cout<<"0\n\n";
        else if(sum>(2*xsum))
            func2(sum,xsum);
        else
        {
            if(sum%2==1) //odd
            {
                sum+=1;
                xsum^=1;
                if(sum==2*xsum)
                    cout<<"1\n1\n";
                else if(sum<2*xsum)
                {
                    cout<<"3\n";
                    cout<<"1"<<" "<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
                }
                else
                    func2(sum-1,xsum^1);
            }
            else
            {
                cout<<"2\n";
                cout<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
            }
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
long long func(long long n)
{
    long long ans=0,count=0;
    while(n>=ans)
        ans+=int(pow(2,count++));
    return ans;
}
int main()
{
    long long t,n,x,sum,xsum;
    cin>>t;
    while(t--)
    {
        sum=xsum=0;
        cin>>n;
        for(int i=0;i<n;i++)
        {
            cin>>x;
            sum+=x;
            xsum^=x;
        }
        if(2*xsum==sum)
            cout<<"0\n\n";
        else if(sum>(2*xsum))
        {
            long long num=func(sum);
            long long add=num^xsum;
            if(sum%2==1 && add%2==0)
                add++;
            else if(sum%2==0 && add%2==1)
                add--;
            xsum^=add;
            sum+=add;
            if(sum==2*xsum)
                cout<<"1\n"<<add<<"\n";
                else{
            cout<<"3\n";
            cout<<add<<" "<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
                }
        }
        else
        {
            if(sum%2==1) //odd
            {
                sum+=1;
                xsum^=1;
                if(sum==2*xsum)
                    cout<<"1\n1\n";
                else if(sum<2*xsum)
                {
                    cout<<"3\n";
                    cout<<"1"<<" "<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
                }
                else
                {
                    sum-=1;
                    xsum^=1;
                   long long num=func(sum);
            long long add=num^xsum;
            //cout<<num<<" "<<add<<endl;
            if(sum%2==1 && add%2==0)
                add++;
            else if(sum%2==0 && add%2==1)
                add--;
            xsum^=add;
            sum+=add;
            if(sum==2*xsum)
                cout<<"1\n"<<add<<"\n";
                else{
            cout<<"3\n";
            cout<<add<<" "<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
                }
                }
            }
            else
            {
                cout<<"2\n";
                cout<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
            }
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
long long func(long long n)
{
    int count=0;
    while(n>0)
    {
        count++;
        n=n/2;
    }
    return (1<<count);
}
int main()
{
    long long t,n,x,sum,xsum;
    cin>>t;
    while(t--)
    {
        sum=xsum=0;
        cin>>n;
        for(int i=0;i<n;i++)
        {
            cin>>x;
            sum+=x;
            xsum^=x;
        }
        if(2*xsum==sum)
            cout<<"0\n\n";
        else if(sum>(2*xsum))
        {
            //long long num=func(sum);
            long long add=func(sum);
            if(sum%2==1 && add%2==0)
                add++;
            else if(sum%2==0 && add%2==1)
                add++;
            xsum^=add;
            sum+=add;
            if(sum==2*xsum)
                cout<<"1\n"<<add<<"\n";
                else{
            cout<<"3\n";
            cout<<add<<" "<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
                }
        }
        else
        {
            if(sum%2==1) //odd
            {
                if(sum+1==2*xsum)
                    cout<<"1\n1\n";
                else
                {
                    sum+=1;
                    cout<<"3\n";
                    cout<<"1"<<" "<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
                }
            }
            else
            {
                cout<<"2\n";
                cout<<((2*xsum)-sum)/2<<" "<<((2*xsum)-sum)/2<<"\n";
            }
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
int compute(long long int S,
            long long int X)
{
    long long int A = (S - X)/2;

    int a = 0, b = 0;
    for (int i=0; i<8*sizeof(S); i++)
    {
        unsigned long int Xi = (X & (1 << i));
        unsigned long int Ai = (A & (1 << i));
        if (Xi == 0 && Ai == 0)
        {
            // Let us leave bits as 0.
        }
        else if (Xi == 0 && Ai > 0)
        {
            a = ((1 << i) | a);
            b = ((1 << i) | b);
        }
        else if (Xi > 0 && Ai == 0)
        {
            a = ((1 << i) | a);
        }
        else
        return 0;
    }

    cout <<a <<" "<< b<<"\n";
}
int main()
{
    long long int t;
    cin>>t;
    while(t--)
    {
        long long int n;
        cin>>n;
        long long int a[n];
        long long int sum=0;
        long long int xr=0;
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
            xr=xr^a[i];
            sum=sum+a[i];
        }
        if(sum==(2*xr))
        {
            cout<<"0\n";
            cout<<"\n";
            continue;
        }
        long long int fi,se,ti;
        fi=xr;
        se=(sum+fi);
        cout<<"3\n";
        cout<<fi<<" ";
        long long int w=4;
        while(!compute((w-1)*se,(w/2)*se))
        w=w+2;

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
void compute(long long int S,
            long long int X)
{
    long long int A = (S - X)/2;

    int a = 0, b = 0;
    for (int i=0; i<8*sizeof(S); i++)
    {
        unsigned long int Xi = (X & (1 << i));
        unsigned long int Ai = (A & (1 << i));
        if (Xi == 0 && Ai == 0)
        {
            // Let us leave bits as 0.
        }
        else if (Xi == 0 && Ai > 0)
        {
            a = ((1 << i) | a);
            b = ((1 << i) | b);
        }
        else if (Xi > 0 && Ai == 0)
        {
            a = ((1 << i) | a);
        }
    }

    cout <<a <<" "<< b<<"\n";
}
int main()
{
    long long int t;
    cin>>t;
    while(t--)
    {
        long long int n;
        cin>>n;
        long long int a[n];
        long long int sum=0;
        long long int xr=0;
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
            xr=xr^a[i];
            sum=sum+a[i];
        }
        if(sum==(2*xr))
        {
            cout<<"0\n";
            cout<<"\n";
            continue;
        }
        if(sum<(2*xr))
        {
            long long int diff = (2*xr)-sum;
            long long int fi,se,ti;
            if(diff%2==0)
            {
               fi  = diff/2;
               se = diff/2;
               cout<<"2\n";
               cout<<fi<<" "<<se<<"\n";
            }
            else
            {
                fi=diff/2;
                se=diff-fi;
                ti=fi^se;
                cout<<"3\n";
                cout<<fi<<" "<<se<<" "<<ti<<"\n";
            }
            continue;
        }
        else
        {
            long long int fi,se,ti;
            fi=xr;
            se=(sum+fi);
            cout<<"3\n";
            cout<<fi<<" ";
            compute(3*se,2*se);
        }

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
void compute(long long int S,
            long long int X)
{
    long long int A = (S - X)/2;

    int a = 0, b = 0;
    for (int i=0; i<8*sizeof(S); i++)
    {
        unsigned long int Xi = (X & (1 << i));
        unsigned long int Ai = (A & (1 << i));
        if (Xi == 0 && Ai == 0)
        {
            // Let us leave bits as 0.
        }
        else if (Xi == 0 && Ai > 0)
        {
            a = ((1 << i) | a);
            b = ((1 << i) | b);
        }
        else if (Xi > 0 && Ai == 0)
        {
            a = ((1 << i) | a);
        }
    }

    cout <<a <<" "<< b;
}
int main()
{
    long long int t;
    cin>>t;
    while(t--)
    {
        long long int n;
        cin>>n;
        long long int a[n];
        long long int sum=0;
        long long int xr=0;
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
            xr=xr^a[i];
            sum=sum+a[i];
        }
        if(sum==(2*xr))
        {
            cout<<"0\n";
            cout<<"\n";
            continue;
        }
        if(sum<(2*xr))
        {
            long long int diff = (2*xr)-sum;
            long long int fi,se,ti;
            if(diff%2==0)
            {
               fi  = diff/2;
               se = diff/2;
               cout<<"2\n";
               cout<<fi<<" "<<se<<"\n";
            }
            else
            {
                fi=diff/2;
                se=diff-fi;
                ti=fi^se;
                cout<<"3\n";
                cout<<fi<<" "<<se<<ti<<"\n";
            }
            continue;
        }
        else
        {
            long long int fi,se,ti;
            fi=xr;
            se=(sum+fi);
            cout<<"3\n";
            cout<<fi<<" ";
            compute(3*se,2*se);
        }

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int compute(long long int S,
            long long int X)
{
    long long int A = (S - X)/2;

    int a = 0, b = 0;
    for (int i=0; i<8*sizeof(S); i++)
    {
        long long int Xi = (X & (1 << i));
        long long int Ai = (A & (1 << i));
        if (Xi == 0 && Ai == 0)
        {
            // Let us leave bits as 0.
        }
        else if (Xi == 0 && Ai > 0)
        {
            a = ((1 << i) | a);
            b = ((1 << i) | b);
        }
        else if (Xi > 0 && Ai == 0)
        {
            a = ((1 << i) | a);
        }
        else
        return 1;
    }

    cout <<a <<" "<<b<<"\n";
    return 0;
}
int main()
{
    long long int t;
    cin>>t;
    while(t--)
    {
        long long int n;
        cin>>n;
        long long int a[n];
        long long int sum=0;
        long long int xr=0;
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
            xr=xr^a[i];
            sum=sum+a[i];
        }
        if(sum==(2*xr))
        {
            cout<<"0\n";
            cout<<"\n";
            continue;
        }
        long long int fi,se,ti;
        fi=xr;
        se=(sum+fi);
        cout<<"2\n";
        cout<<fi<<" "<<se<<"\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
void compute(long long int S,
            long long int X)
{
    long long int A = (S - X)/2;

    int a = 0, b = 0;
    for (int i=0; i<8*sizeof(S); i++)
    {
        unsigned long int Xi = (X & (1 << i));
        unsigned long int Ai = (A & (1 << i));
        if (Xi == 0 && Ai == 0)
        {
            // Let us leave bits as 0.
        }
        else if (Xi == 0 && Ai > 0)
        {
            a = ((1 << i) | a);
            b = ((1 << i) | b);
        }
        else if (Xi > 0 && Ai == 0)
        {
            a = ((1 << i) | a);
        }
    }

    cout <<a <<" "<< b;
}
int main()
{
    long long int t;
    cin>>t;
    while(t--)
    {
        long long int n;
        cin>>n;
        long long int a[n];
        long long int sum=0;
        long long int xr=0;
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
            xr=xr^a[i];
            sum=sum+a[i];
        }
        if(sum==(2*xr))
        {
            cout<<"0\n";
            cout<<"\n";
            continue;
        }
        if(sum<(2*xr))
        {
            long long int diff = (2*xr)-sum;
            long long int fi,se,ti;
            if(diff%2==0)
            {
               fi  = diff/2;
               se = diff/2;
               cout<<"2\n";
               cout<<fi<<" "<<se<<"\n";
            }
            else
            {
                fi=diff/2;
                se=diff-fi;
                ti=fi^se;
                cout<<"3\n";
                cout<<fi<<" "<<se<<ti<<"\n";
            }
            continue;
        }
        else
        {
            long long lb=0;
    		long long ub = 1e6;
    		long long ans;
    		while(lb <= ub)
    		{
    			long long mid = lb + ((ub - lb)>>1);
    			if(mid+sum == 2*(xr ^ mid))
    			{
    				ans = mid;
    				break;
    			}
    			else
    			{
    			    if(mid+sum<2*(xr^mid))
    			    {
    				    ub=mid - 1;
    			    }
    			    else
    			    {
    				    lb = mid + 1;
    			    }
    			}
    		}
    		cout<<1<<"\n"<<ans<<"\n";
        }

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int compute(long long int S,
            long long int X)
{
    long long int A = (S - X)/2;

    int a = 0, b = 0;
    for (int i=0; i<8*sizeof(S); i++)
    {
        long long int Xi = (X & (1 << i));
        long long int Ai = (A & (1 << i));
        if (Xi == 0 && Ai == 0)
        {
            // Let us leave bits as 0.
        }
        else if (Xi == 0 && Ai > 0)
        {
            a = ((1 << i) | a);
            b = ((1 << i) | b);
        }
        else if (Xi > 0 && Ai == 0)
        {
            a = ((1 << i) | a);
        }
        else
        return 1;
    }

    cout <<a <<" "<<b<<"\n";
    return 0;
}
int main()
{
    long long int t;
    cin>>t;
    while(t--)
    {
        long long int n;
        cin>>n;
        long long int a[n];
        long long int sum=0;
        long long int xr=0;
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
            xr=xr^a[i];
            sum=sum+a[i];
        }
        if(sum==(2*xr))
        {
            cout<<"0\n";
            cout<<"\n";
            continue;
        }
        long long int fi,se,ti;
        fi=xr;
        se=(sum+fi);
        cout<<"3\n";
        cout<<fi<<" ";
        long long int w=2;
        compute((w-1)*se,(w/2)*se);
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
void compute(long long int S,
            long long int X)
{
    long long int A = (S - X)/2;

    int a = 0, b = 0;
    for (int i=0; i<8*sizeof(S); i++)
    {
        unsigned long int Xi = (X & (1 << i));
        unsigned long int Ai = (A & (1 << i));
        if (Xi == 0 && Ai == 0)
        {
            // Let us leave bits as 0.
        }
        else if (Xi == 0 && Ai > 0)
        {
            a = ((1 << i) | a);
            b = ((1 << i) | b);
        }
        else if (Xi > 0 && Ai == 0)
        {
            a = ((1 << i) | a);
        }
    }

    cout <<a <<" "<< b;
}
int main()
{
    long long int t;
    cin>>t;
    while(t--)
    {
        long long int n;
        cin>>n;
        long long int a[n];
        long long int sum=0;
        long long int xr=0;
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
            xr=xr^a[i];
            sum=sum+a[i];
        }
        if(sum==(2*xr))
        {
            cout<<"0\n";
            cout<<"\n";
            continue;
        }
        if(sum<(2*xr))
        {
            long long int diff = (2*xr)-sum;
            long long int fi,se,ti;
            if(diff%2==0)
            {
               fi  = diff/2;
               se = diff/2;
               cout<<"2\n";
               cout<<fi<<" "<<se<<"\n";
            }
            else
            {
                fi=diff/2;
                se=diff-fi;
                ti=fi^se;
                cout<<"3\n";
                cout<<fi<<" "<<se<<" "<<ti<<"\n";
            }
            continue;
        }
        else
        {
            long long int fi,se,ti;
            fi=xr;
            se=(sum+fi);
            cout<<"3\n";
            cout<<fi<<" ";
            compute(3*se,2*se);
        }

    }
    return 0;
}


#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define speed                                                                  \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define oprecision                                                             \
  cout.precision(30);                                                          \
  cerr.precision(7);
#define bb bool
#define ii int
#define ll long long
#define ff float
#define dd double
#define cc char
#define ss string
#define forn(sz) for (int i = 1; i <= sz; i++)
#define forni(i, sz) for (int i = 1; i <= sz; i++)
#define fornid(i, m, sz) for (int i = m; i <= sz; i++)
#define all(v) v.begin(), v.end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vii vector<ii>
#define vii64 vector<ll>
#define vb vector<bb>
using namespace std;
int q;
int main() {
  speed;
  oprecision;
  /*#ifndef ONLINE_JUDGE
freopen("outd.txt", "rt", stdin);
#endif*/
  // code
  cin >> q;
  while (q--) {
    ll sz, cur = 0, x = 0, arr[500005];
    cin >> sz;
    forn(sz) {
      cin >> arr[i];
      cur += arr[i];
      if (i > 1) {
        x ^= arr[i];
      } else {
        x = arr[i];
      }
    }
    cout << "2\n" << x << " " << cur + x << "\n";
  }
// endl
#ifndef ONLINE_JUDGE
  cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
  return 0;
}


#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <iostream>
#include <random>
#define speed                     \
	ios_base::sync_with_stdio(0); \
	cin.tie(0);                   \
	cout.tie(0);
#define oprecision      \
	cout.precision(30); \
	cerr.precision(7);
#define bb bool
#define ii int
#define ll long long
#define ff float
#define dd double
#define cc char
#define ss string
#define forn(sz) for (int i = 1; i <= sz; i++)
#define forni(i, sz) for (int i = 1; i <= sz; i++)
#define fornid(i, m, sz) for (int i = m; i <= sz; i++)
#define all(v) v.begin(), v.end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vii vector<ii>
#define vii64 vector<ll>
#define vb vector<bb>
using namespace std;
mt19937_64 mrand(random_device{}());
const ll kM = (1LL << 62) - 1;
ll q, mx, sz, m, cur, x, arr[500005];
bool check(long long ch)
{
	long long tcur = cur + ch, tx = x ^ ch;
	return tcur == tx * 2;
}
int main()
{
	speed;
	oprecision;
	/*#ifndef ONLINE_JUDGE
freopen("outd.txt", "rt", stdin);
#endif*/
	// code
	cin >> q;
	while (q--)
	{
		mx = 0, cur = 0, x = 0;
		cin >> sz;
		forn(sz)
		{
			cin >> arr[i];
			mx = max(arr[i], mx);
			cur += arr[i];
			if (i > 1)
			{
				x ^= arr[i];
			}
			else
			{
				x = arr[i];
			}
		}
		if (check(0))
		{
			cout << "1\n0\n";
		}
		else
		{
			while (!check(m))
			{
				m = (mrand() & kM) % (cur * 3) + 1LL;
			}
			cout << "1\n"
				 << m << "\n";
		}
	}
// endl
#ifndef ONLINE_JUDGE
	cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <iostream>
#include <random>
#define speed                     \
	ios_base::sync_with_stdio(0); \
	cin.tie(0);                   \
	cout.tie(0);
#define oprecision      \
	cout.precision(30); \
	cerr.precision(7);
#define bb bool
#define ii int
#define ll long long
#define ff float
#define dd double
#define cc char
#define ss string
#define forn(sz) for (int i = 1; i <= sz; i++)
#define forni(i, sz) for (int i = 1; i <= sz; i++)
#define fornid(i, m, sz) for (int i = m; i <= sz; i++)
#define all(v) v.begin(), v.end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vii vector<ii>
#define vii64 vector<ll>
#define vb vector<bb>
using namespace std;
mt19937_64 mrand(random_device{}());
const ll kM = (1LL << 62) - 1;
ll q, mx, b, sz, m, cur, x, arr[500005];
bool check(long long ch)
{
	long long tcur = cur + ch, tx = x ^ ch;
	return tcur == tx * 2;
}
int main()
{
	speed;
	oprecision;
	/*#ifndef ONLINE_JUDGE
freopen("outd.txt", "rt", stdin);
#endif*/
	// code
	cin >> q;
	while (q--)
	{
		mx = 0, b = 0, cur = 0, x = 0;
		cin >> sz;
		forn(sz)
		{
			cin >> arr[i];
			mx = max(arr[i], mx);
			cur += arr[i];
			if (i > 1)
			{
				x ^= arr[i];
			}
			else
			{
				x = arr[i];
			}
		}
		while (!check(b))
		{
			b++;
		}
		cout << "1\n"
			 << b << "\n";
	}
// endl
#ifndef ONLINE_JUDGE
	cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <iostream>
#include <random>
#define speed                     \
	ios_base::sync_with_stdio(0); \
	cin.tie(0);                   \
	cout.tie(0);
#define oprecision      \
	cout.precision(30); \
	cerr.precision(7);
#define bb bool
#define ii int
#define ll long long
#define ff float
#define dd double
#define cc char
#define ss string
#define forn(sz) for (int i = 1; i <= sz; i++)
#define forni(i, sz) for (int i = 1; i <= sz; i++)
#define fornid(i, m, sz) for (int i = m; i <= sz; i++)
#define all(v) v.begin(), v.end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vii vector<ii>
#define vii64 vector<ll>
#define vb vector<bb>
using namespace std;
mt19937_64 mrand(random_device{}());
const ll kM = (1ll << 62) - 1;
ll q, mx, sz, m, cur, x, arr[500005];
bool check(long long ch)
{
	long long tcur = cur + ch, tx = x ^ ch;
	return tcur == tx * 2;
}
int main()
{
	speed;
	oprecision;
	/*#ifndef ONLINE_JUDGE
freopen("outd.txt", "rt", stdin);
#endif*/
	// code
	cin >> q;
	while (q--)
	{
		mx = 0, cur = 0, x = 0;
		cin >> sz;
		forn(sz)
		{
			cin >> arr[i];
			mx = max(arr[i], mx);
			cur += arr[i];
			if (i > 1)
			{
				x ^= arr[i];
			}
			else
			{
				x = arr[i];
			}
		}
		while (!check(m))
			m = (mrand() & kM) % mx + 1;
		cout << "1\n"
			 << m << "\n";
	}
// endl
#ifndef ONLINE_JUDGE
	cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <iostream>
#include <random>
#define speed                     \
	ios_base::sync_with_stdio(0); \
	cin.tie(0);                   \
	cout.tie(0);
#define oprecision      \
	cout.precision(30); \
	cerr.precision(7);
#define bb bool
#define ii int
#define ll long long
#define ff float
#define dd double
#define cc char
#define ss string
#define forn(sz) for (int i = 1; i <= sz; i++)
#define forni(i, sz) for (int i = 1; i <= sz; i++)
#define fornid(i, m, sz) for (int i = m; i <= sz; i++)
#define all(v) v.begin(), v.end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vii vector<ii>
#define vii64 vector<ll>
#define vb vector<bb>
using namespace std;
mt19937_64 mrand(random_device{}());
const ll kM = (1LL << 62) - 1;
ll q, sz, m, cur, x, arr[500005];
bool check(long long ch)
{
	long long tcur = cur + ch, tx = x ^ ch;
	return tcur == tx * 2;
}
int main()
{
	speed;
	oprecision;
	/*#ifndef ONLINE_JUDGE
freopen("outd.txt", "rt", stdin);
#endif*/
	// code
	cin >> q;
	while (q--)
	{
		cur = 0, x = 0;
		cin >> sz;
		forn(sz)
		{
			cin >> arr[i];
			cur += arr[i];
			if (i > 1)
			{
				x ^= arr[i];
			}
			else
			{
				x = arr[i];
			}
		}
		if (check(0))
		{
			cout << "1\n0\n";
		}
		else
		{
			while (!check(m))
			{
				m = (mrand() & kM) % (cur * 10LL) + 1LL;
			}
			cout << "1\n"
				 << m << "\n";
		}
	}
// endl
#ifndef ONLINE_JUDGE
	cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define speed                                                                  \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define oprecision                                                             \
  cout.precision(30);                                                          \
  cerr.precision(7);
#define bb bool
#define ii int
#define ll long long
#define ff float
#define dd double
#define cc char
#define ss string
#define forn(sz) for (int i = 1; i <= sz; i++)
#define forni(i, sz) for (int i = 1; i <= sz; i++)
#define fornid(i, m, sz) for (int i = m; i <= sz; i++)
#define all(v) v.begin(), v.end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vii vector<ii>
#define vii64 vector<ll>
#define vb vector<bb>
using namespace std;
int q;
int main() {
  speed;
  oprecision;
  /*#ifndef ONLINE_JUDGE
freopen("outd.txt", "rt", stdin);
#endif*/
  // code
  cin >> q;
  while (q--) {
    ll sz, cur = 0, x = 0, arr[500005];
    cin >> sz;
    forn(sz) {
      cin >> arr[i];
      cur += arr[i];
      if (i > 1) {
        x ^= arr[i];
      } else {
        x = arr[i];
      }
    }
    cout << "2\n" << x << " " << cur * 2 << "\n";
  }
// endl
#ifndef ONLINE_JUDGE
  cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
  return 0;
}


#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <iostream>
#include <random>
#define speed                     \
	ios_base::sync_with_stdio(0); \
	cin.tie(0);                   \
	cout.tie(0);
#define oprecision      \
	cout.precision(30); \
	cerr.precision(7);
#define bb bool
#define ii int
#define ll long long
#define ff float
#define dd double
#define cc char
#define ss string
#define forn(sz) for (int i = 1; i <= sz; i++)
#define forni(i, sz) for (int i = 1; i <= sz; i++)
#define fornid(i, m, sz) for (int i = m; i <= sz; i++)
#define all(v) v.begin(), v.end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vii vector<ii>
#define vii64 vector<ll>
#define vb vector<bb>
using namespace std;
mt19937_64 mrand(random_device{}());
const ll kM = (1LL << 62) - 1;
ll q, mx, sz, m, cur, x, arr[500005];
bool check(long long ch)
{
	long long tcur = cur + ch, tx = x ^ ch;
	return tcur == tx * 2;
}
int main()
{
	speed;
	oprecision;
	/*#ifndef ONLINE_JUDGE
freopen("outd.txt", "rt", stdin);
#endif*/
	// code
	cin >> q;
	while (q--)
	{
		mx = 0, cur = 0, x = 0;
		cin >> sz;
		forn(sz)
		{
			cin >> arr[i];
			mx = max(arr[i], mx);
			cur += arr[i];
			if (i > 1)
			{
				x ^= arr[i];
			}
			else
			{
				x = arr[i];
			}
		}
		if (check(0))
		{
			cout << "1\n0\n";
		}
		else
		{
			while (!check(m))
			{
				m = (mrand() & kM) % (mx * 10);
			}
			cout << "1\n"
				 << m << "\n";
		}
	}
// endl
#ifndef ONLINE_JUDGE
	cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <iostream>
#include <random>
#define speed                     \
	ios_base::sync_with_stdio(0); \
	cin.tie(0);                   \
	cout.tie(0);
#define oprecision      \
	cout.precision(30); \
	cerr.precision(7);
#define bb bool
#define ii int
#define ll long long
#define ff float
#define dd double
#define cc char
#define ss string
#define forn(sz) for (int i = 1; i <= sz; i++)
#define forni(i, sz) for (int i = 1; i <= sz; i++)
#define fornid(i, m, sz) for (int i = m; i <= sz; i++)
#define all(v) v.begin(), v.end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vii vector<ii>
#define vii64 vector<ll>
#define vb vector<bb>
using namespace std;
mt19937_64 mrand(random_device{}());
const ll kM = (1LL << 62) - 1;
ll q, mx, sz, m, cur, x, arr[500005];
bool check(long long ch)
{
	long long tcur = cur + ch, tx = x ^ ch;
	return tcur == tx * 2;
}
uint32_t xor128(void) {
  static uint32_t x = 123456789;
  static uint32_t y = 362436069;
  static uint32_t z = 521288629;
  static uint32_t w = 88675123;
  uint32_t t;
  t = x ^ (x << 11);
  x = y;
  y = z;
  z = w;
  return w = w ^ (w >> 19) ^ (t ^ (t >> 8));
}
int main()
{
	speed;
	oprecision;
	/*#ifndef ONLINE_JUDGE
freopen("outd.txt", "rt", stdin);
#endif*/
	// code
	cin >> q;
	while (q--)
	{
		mx = 0, cur = 0, x = 0;
		cin >> sz;
		forn(sz)
		{
			cin >> arr[i];
			mx = max(arr[i], mx);
			cur += arr[i];
			if (i > 1)
			{
				x ^= arr[i];
			}
			else
			{
				x = arr[i];
			}
		}
		if (check(0))
		{
			cout << "1\n0\n";
		}
		else
		{
			while (!check(m))
			{
				m = (xor128() & kM) % (mx * 10);
			}
			cout << "1\n"
				 << m << "\n";
		}
	}
// endl
#ifndef ONLINE_JUDGE
	cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
multiset<int> cur;

int largest(){
	assert(cur.size()>0);
	auto it = cur.end();
	return *(--it);
}
int smallest(){
	assert(cur.size()>0);
	return *(cur.begin());
}

void test_case(){
	cur.clear();
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i=0;i<n;i++) {
		cin >> a[i];
		cur.insert(a[i]);
	}

	int i=0, j=n-1;
	while(i<j){

		if(largest()-smallest() >= cur.size()){
			cout <<"YES" << endl;
			cout <<1+i<<" "<<1+j<<endl;
			return;
		}
		cur.erase(cur.find(a[i]));
		int ldif = largest()-smallest();
		cur.insert(a[i]);

		cur.erase(cur.find(a[j]));
		int rdif = largest()-smallest();
		cur.insert(a[j]);

		if(ldif >= rdif){
			cur.erase(cur.find(a[i]));
			i++;
		}else{
			cur.erase(cur.find(a[j]));
			j--;
		}
	}
	cout << "NO" << endl;
}

int main(){
	ios_base::sync_with_stdio(false); cin.tie(nullptr);
	int t=1;
	cin >> t;

	while(t--) test_case();

	return 0;
}


#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;

void test_case(){
	int n;
	cin >> n;
	long long x=0,s=0;

	for(int i=0;i<n;i++) {
		long long ar;
		cin >> ar;
		x ^= ar;
		s += ar;
	}

	vector<long long> temp;

		long long num = (1LL<<50) + s%2;
		s += num;
		x ^= num;

	cout << 3 << endl;
	cout << num << " " << (2*x-s)/2 << " " << (2*x-s)/2 << endl;

}

int main(){
	ios_base::sync_with_stdio(false); cin.tie(nullptr);
	int t=1;
	cin >> t;

	while(t--) test_case();

	return 0;
}


#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;

void test_case(){
	int n;
	cin >> n;
	long long x=0,s=0;

	for(int i=0;i<n;i++) {
		long long ar;
		cin >> ar;
		x ^= ar;
		s += ar;
	}

	cout << 2 << endl;
	cout << s+x << " " << x << endl;

}

int main(){
	ios_base::sync_with_stdio(false); cin.tie(nullptr);
	int t=1;
	cin >> t;

	while(t--) test_case();

	return 0;
}


#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;

void test_case(){
	int n;
	cin >> n;
	vector<long long> arr(n);
	long long x=0,s=0;

	for(int i=0;i<n;i++) {
		cin >> arr[i];
		x ^= arr[i];
		s += arr[i];
	}
	// cout <<"x="<<x <<" "<< "s="<<s<<endl;
	vector<long long> temp;

	if(!(s%2==0 && s<=2*x )){
		long long ss = (1LL<<40) + s%2;
		s += ss;
		x ^= ss;
		temp.push_back(ss);
	}

	temp.push_back((2*x-s)/2);
	temp.push_back((2*x-s)/2);
	cout << temp.size( ) << endl;
	for(long long a : temp) cout << a << " ";
	cout << endl;

	// cout <<"xx=" << (x^((2*x-s)/2)^((2*x-s)/2)) <<" ss="<<s+((2*x-s)/2)+(2*x-s)/2 << endl;
}

int main(){
	ios_base::sync_with_stdio(false); cin.tie(nullptr);
	int t=1;
	cin >> t;

	while(t--) test_case();

	return 0;
}


#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;

void test_case(){
	int n;
	cin >> n;
	long long x=0,s=0;

	for(int i=0;i<n;i++) {
		long long ar;
		cin >> ar;
		x ^= ar;
		s += ar;
	}

	cout << 2 << endl;
	cout << s << " " << x << endl;

}

int main(){
	ios_base::sync_with_stdio(false); cin.tie(nullptr);
	int t=1;
	cin >> t;

	while(t--) test_case();

	return 0;
}


    #include<bits/stdc++.h>
    #define ll long long
    using namespace std;
    int a[200005];
    long long f(long long res)
    {
        long long r=1;
        for(int i=1;; i++)
        {
            if(r>=res)
                return r/2;
                r*=2;
        }
    }
    int main()
    {
        //printf("%d",6^1^10);
        int t;
        scanf("%d",&t);
        while(t--)
        {
            int n;
            scanf("%d",&n);
            long long res = 0;
            long long resx = 0;
            for(int i=0; i<n; i++)
            {
                long long x;
                scanf("%lld",&x);
                res  += x;
                resx ^= x;
            }
            if(res%2==0 &&res/2==resx)
            {
                printf("0\n\n");
                continue;
            }

            res+=resx;
            if(resx==0)
            {
                printf("1\n%lld\n",res);
            }else
            {
                printf("2\n%lld %lld\n",resx,res);
            }

        }
    }


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int a[200005];
long long f(long long res)
{
    long long r=1;
    for(int i=1;; i++)
    {
        if(r>=res)
            return r/2;
            r*=2;
    }
}
int main()
{
    //printf("%d",6^1^10);
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int n;
        scanf("%d",&n);
        long long res = 0;
        long long resx = 0;
        for(int i=0; i<n; i++)
        {
            long long x;
            scanf("%lld",&x);
            res  += x;
            resx ^= x;
        }
        if(res%2==0 &&res/2==resx)
        {
            printf("0\n\n");
            continue;
        }
        if(res%2==0)
        {
            if(res==resx)
            {
                printf("2\n");
                printf("%lld %lld\n",resx/2,resx/2);
            }
            else
            {
                printf("3\n");
                printf("%lld %lld %lld\n",resx,(res+resx)/2,(res+resx)/2);
            }
        }
        else
        {
            res+=resx;
            printf("2\n");
            printf("%lld %lld\n",resx,res);
        }

    }
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int a[200005];
long long f(long long res)
{
    long long r=1;
    for(int i=1;;i++)
    {
        r*=2;
        if(r>res)
            return r/2;
    }
}
int main()
{
    //printf("%d",6^1^10);
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int n;
        scanf("%d",&n);
        long long res = 0;
        long long resx = 0;
        for(int i=0; i<n; i++)
        {
            long long x;
            scanf("%lld",&x);
            res  += x;
            resx ^= x;
        }
        if(res%2==0)
        {
            if(res/2==resx)
            {
                printf("0\n\n");
            }
            else
            {
                if(resx==0)
                {
                    printf("1\n");
                    printf("%lld\n",res);
                }
                else
                {
                    printf("2\n");
                    long long k = res+resx;
                    k = k/2;
                    printf("%lld %lld \n",k/2,k/2);
                }
            }
            continue;
        }
        if(res % 2==1)
        {
            res+=resx;
            res/=2;
            if(res%2==0)
            {
                printf("2\n");
                printf("%lld %lld\n",resx,res);
            }
            else
            {
                long long k2 = f(res);
                printf("3\n");
                printf("%lld %lld %lld\n",resx,k2,res-k2);
            }
        }
    }
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int a[200005];

int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int n;
        scanf("%d",&n);
        long long res = 0;
        long long resx = 0;
        for(int i=0; i<n; i++)
        {
            long long x;
            scanf("%lld",&x);
            res += x;
            resx ^= x;
        }
        if(res%2==0)
        {
            if(res/2==resx)
            {
                printf("0\n\n");
            }
            else
            {
                if(resx==0)
                {
                    printf("1\n");
                    printf("%lld\n",res);
                }
                else
                {
                    printf("2\n");
                    long long k = resx/2;
                    printf("%lld %lld\n",k,k);
                }
            }
            continue;
        }
        if(res % 2==1)
        {
            res++;
            resx^=1;
            if(res/2 == resx)
            {
                printf("1\n1\n");
            }
            else
            {
                if(resx==0)
                {
                    printf("2\n");
                    printf("1 %lld\n",res);
                }
                else
                {
                    printf("3\n");
                    long long k = resx/2;
                    printf("1 %lld %lld\n",k,k);
                }
            }
            continue;
        }
    }
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int a[200005];

int main()
{
    printf("%d",1^2^3^6^7);
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int n;
        scanf("%d",&n);
        long long res = 0;
        long long resx = 0;
        for(int i=0; i<n; i++)
        {
            long long x;
            scanf("%lld",&x);
            res += x;
            resx ^= x;
        }
        if(res%2==0)
        {
            if(res/2==resx)
            {
                printf("0\n\n");
            }
            else
            {
                if(resx==0)
                {
                    printf("1\n");
                    printf("%lld\n",res);
                }
                else
                {
                    printf("2\n");
                    long long k = resx/2;
                    printf("%lld %lld\n",k,k);
                }
            }
            continue;
        }
        if(res % 2==1)
        {
            res++;
            resx^=1;
            if(res/2 == resx)
            {
                printf("1\n1\n");
            }
            else
            {
                if(resx==0)
                {
                    printf("2\n");
                    printf("1 %lld\n",res);
                }
                else
                {
                    printf("3\n");
                    long long k = resx/2;
                    printf("1 %lld %lld\n",k,k);
                }
            }
            continue;
        }
    }
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int a[200005];

int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int n;
        scanf("%d",&n);
        long long res = 0;
        long long resx = 0;
        for(int i=0; i<n; i++)
        {
            long long x;
            scanf("%lld",&x);
            res += x;
            resx ^= x;
        }
        if(res%2==0)
        {
            if(res/2==resx)
            {
                printf("0\n\n");
            }
            else
            {
                if(resx==0)
                {
                    printf("1\n");
                    printf("%d\n",res);
                }
                else
                {
                    printf("2\n");
                    long long k = resx/2;
                    printf("%lld %lld\n",k,k);
                }
            }
            continue;
        }
        if(res % 2==1)
        {
            res++;
            resx^=1;
            if(res/2 == resx)
            {
                printf("1\n1\n");
            }
            else
            {
                if(resx==0)
                {
                    printf("1\n");
                    printf("%d\n",res);
                }
                else
                {
                    printf("3\n");
                    long long k = resx/2;
                    printf("1 %lld %lld\n",k,k);
                }
            }
            continue;
        }
    }
}