import java.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.Map.Entry;

import static java.lang.Math.*;

public class Solve implements Runnable{
    
final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
    
    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");
    
    void init() throws FileNotFoundException{
        if (ONLINE_JUDGE){
            //in = new BufferedReader(new InputStreamReader(System.in));
            //out = new PrintWriter(System.out);
            
            in = new BufferedReader(new FileReader("08"));
            out = new PrintWriter("output.txt");
        }else{  
        	in = new BufferedReader(new FileReader("08"));
            out = new PrintWriter("output.txt");
             // in = new BufferedReader(new FileReader("input.txt"));
            //out = new PrintWriter("output.txt");
        }
    }
    
    String readString() throws IOException{
        while(!tok.hasMoreTokens()){
            try{
                tok = new StringTokenizer(in.readLine());
            }catch (Exception e){
                return null;
            }
        }
        return tok.nextToken();
    }
    
    int readInt() throws IOException{
        return Integer.parseInt(readString());
    }
    
    long readLong() throws IOException{
        return Long.parseLong(readString());
    }
    
    double readDouble() throws IOException{
        return Double.parseDouble(readString());
    }
    
    public static void main(String[] args){
        new Thread(null, new Solve(), "", 256 * (1L << 20)).start();
    }
    
    long timeBegin, timeEnd;

    void time(){
        timeEnd = System.currentTimeMillis();
        System.err.println("Time = " + (timeEnd - timeBegin));
    }
    
    void debug(Object... objects){
        if (!ONLINE_JUDGE){
            for (Object o: objects){
                System.err.println(o.toString());
            }
        }
    }
    
    int sm(int x){
        if (x==1) return 0;else return 1;
    }
    
    int gcd(int a,int b){
        if (b==0) return a;
        else{
            return gcd(b,a%b);
        }
    } 
    
    
       
    
    
   
  
   
   
    
    
    
    
   public void solve() throws IOException{
	   int n=readInt();  
	  
	   for (int i=0;i<n;i++){
		   int k=readInt();
		   int[] a=new int[k];
		   for (int j=0;j<k;j++){
			   a[j]=readInt();
		   }
		   Arrays.sort(a);
		   long k1=0;
		   for (int j=0;j<k/2;j++){
			   k1+=(long)a[j];
		   }
		   int k2=0;
		   for (int j=k/2;j<k;j++){
			   k2+=(long)a[j];
		   }		   
		   out.println(Math.abs(k2-k1)); 
		   
	   }
	  
	   
	   

	   
	   
	   
	   
	   
	   
	   
	   
   }
        
        
        
    
    
    public void run(){
        try{
            timeBegin = System.currentTimeMillis();      
            
            
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            
            
            solve();
            
            out.close();
            //time();
        }catch (Exception e){
            e.printStackTrace(System.err);
            System.exit(-1);
        }
    }
    
    
}