import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
 

//result = Math.pow(num1, num3)
//StringBuffer str = new StringBuffer(hoge1);
//String hoge2 = str.reverse().toString();
//map.containsKey(A)

//Map<String, Integer> map = new HashMap<String, Integer>(n);
/*for ( キーのデータ型 key : マップの名前.keySet() ) {
	データのデータ型 data = マップの名前.get( key );
	
	// keyやdataを使った処理;
}*/
//int i = Integer.parseInt(s);
//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
//ArrayList<String> cc = new ArrayList<>(n);
//Collections.sort(list);
//Array.sort(list);
//Arrays.asList(c).contains("a")
//list.set(1,"walk");
public class Main {
	static int a1[]= {0,-1,0,1};
	static int b1[]= {-1,0,1,0};
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	static int K;
	public static void main(String[] args) {
		int N=sc.nextInt();
		ArrayList<Integer> cc = new ArrayList<>(N);
		for(int i=0;i<N;i++) {
			cc.add(sc.nextInt());
		}
		Collections.sort(cc);
		Collections.reverse(cc);
		int ans1=0;
		int ans2=0;
		for(int i=1;i<=N;i++) {
			if(i%2==1) {
				ans1+=cc.get(i-1);
			}else {
				ans2+=cc.get(i-1);
			}
		}
		p(ans1-ans2);
	}
} import java.util.ArrayDeque; ArrayDeque java.util import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.Collections; Collections java.util import java.util.HashMap; HashMap java.util import java.util.Map; Map java.util import java.util.Queue; Queue java.util import java.util.Scanner; Scanner java.util public class Main {
	static int a1[]= {0,-1,0,1};
	static int b1[]= {-1,0,1,0};
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	static int K;
	public static void main(String[] args) {
		int N=sc.nextInt();
		ArrayList<Integer> cc = new ArrayList<>(N);
		for(int i=0;i<N;i++) {
			cc.add(sc.nextInt());
		}
		Collections.sort(cc);
		Collections.reverse(cc);
		int ans1=0;
		int ans2=0;
		for(int i=1;i<=N;i++) {
			if(i%2==1) {
				ans1+=cc.get(i-1);
			}else {
				ans2+=cc.get(i-1);
			}
		}
		p(ans1-ans2);
	}
} Main static int a1[]= {0,-1,0,1}; a1 {0,-1,0,1} 0 -1 1 0 1 static int b1[]= {-1,0,1,0}; b1 {-1,0,1,0} -1 1 0 1 0 private static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) static int K; K static void p(String ans) {System.out.println(ans);} p {System.out.println(ans);} System.out.println(ans) System.out.println System.out System System.out ans String ans ans static void p(int ans) {System.out.println(ans);} p {System.out.println(ans);} System.out.println(ans) System.out.println System.out System System.out ans int ans ans static void p(long ans) {System.out.println(ans);} p {System.out.println(ans);} System.out.println(ans) System.out.println System.out System System.out ans long ans ans static void p(double ans) {System.out.println(ans);} p {System.out.println(ans);} System.out.println(ans) System.out.println System.out System System.out ans double ans ans public static void main(String[] args) {
		int N=sc.nextInt();
		ArrayList<Integer> cc = new ArrayList<>(N);
		for(int i=0;i<N;i++) {
			cc.add(sc.nextInt());
		}
		Collections.sort(cc);
		Collections.reverse(cc);
		int ans1=0;
		int ans2=0;
		for(int i=1;i<=N;i++) {
			if(i%2==1) {
				ans1+=cc.get(i-1);
			}else {
				ans2+=cc.get(i-1);
			}
		}
		p(ans1-ans2);
	} main {
		int N=sc.nextInt();
		ArrayList<Integer> cc = new ArrayList<>(N);
		for(int i=0;i<N;i++) {
			cc.add(sc.nextInt());
		}
		Collections.sort(cc);
		Collections.reverse(cc);
		int ans1=0;
		int ans2=0;
		for(int i=1;i<=N;i++) {
			if(i%2==1) {
				ans1+=cc.get(i-1);
			}else {
				ans2+=cc.get(i-1);
			}
		}
		p(ans1-ans2);
	} int N=sc.nextInt(); N sc.nextInt() sc.nextInt sc ArrayList<Integer> cc = new ArrayList<>(N); cc new ArrayList<>(N) for(int i=0;i<N;i++) {
			cc.add(sc.nextInt());
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			cc.add(sc.nextInt());
		} {
			cc.add(sc.nextInt());
		} cc.add(sc.nextInt()) cc.add cc sc.nextInt() sc.nextInt sc Collections.sort(cc) Collections.sort Collections cc Collections.reverse(cc) Collections.reverse Collections cc int ans1=0; ans1 0 int ans2=0; ans2 0 for(int i=1;i<=N;i++) {
			if(i%2==1) {
				ans1+=cc.get(i-1);
			}else {
				ans2+=cc.get(i-1);
			}
		} int i=1; int i=1; i 1 i<=N i N i++ i++ i {
			if(i%2==1) {
				ans1+=cc.get(i-1);
			}else {
				ans2+=cc.get(i-1);
			}
		} {
			if(i%2==1) {
				ans1+=cc.get(i-1);
			}else {
				ans2+=cc.get(i-1);
			}
		} if(i%2==1) {
				ans1+=cc.get(i-1);
			}else {
				ans2+=cc.get(i-1);
			} i%2==1 i%2 i 2 1 {
				ans1+=cc.get(i-1);
			} ans1+=cc.get(i-1) ans1 cc.get(i-1) cc.get cc i-1 i 1 {
				ans2+=cc.get(i-1);
			} ans2+=cc.get(i-1) ans2 cc.get(i-1) cc.get cc i-1 i 1 p(ans1-ans2) p ans1-ans2 ans1 ans2 String[] args args public class Main {
	static int a1[]= {0,-1,0,1};
	static int b1[]= {-1,0,1,0};
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	static int K;
	public static void main(String[] args) {
		int N=sc.nextInt();
		ArrayList<Integer> cc = new ArrayList<>(N);
		for(int i=0;i<N;i++) {
			cc.add(sc.nextInt());
		}
		Collections.sort(cc);
		Collections.reverse(cc);
		int ans1=0;
		int ans2=0;
		for(int i=1;i<=N;i++) {
			if(i%2==1) {
				ans1+=cc.get(i-1);
			}else {
				ans2+=cc.get(i-1);
			}
		}
		p(ans1-ans2);
	}
} public class Main {
	static int a1[]= {0,-1,0,1};
	static int b1[]= {-1,0,1,0};
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	static int K;
	public static void main(String[] args) {
		int N=sc.nextInt();
		ArrayList<Integer> cc = new ArrayList<>(N);
		for(int i=0;i<N;i++) {
			cc.add(sc.nextInt());
		}
		Collections.sort(cc);
		Collections.reverse(cc);
		int ans1=0;
		int ans2=0;
		for(int i=1;i<=N;i++) {
			if(i%2==1) {
				ans1+=cc.get(i-1);
			}else {
				ans2+=cc.get(i-1);
			}
		}
		p(ans1-ans2);
	}
} Main
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
 

//result = Math.pow(num1, num3)
//StringBuffer str = new StringBuffer(hoge1);
//String hoge2 = str.reverse().toString();
//map.containsKey(A)

//Map<String, Integer> map = new HashMap<String, Integer>(n);
/*for ( キーのデータ型 key : マップの名前.keySet() ) {
	データのデータ型 data = マップの名前.get( key );
	
	// keyやdataを使った処理;
}*/
//int i = Integer.parseInt(s);
//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
//ArrayList<String> cc = new ArrayList<>(n);
//Collections.sort(list);
//Array.sort(list);
//Arrays.asList(c).contains("a")
//list.set(1,"walk");
public class Main {
	static int a1[]= {0,-1,0,1};
	static int b1[]= {-1,0,1,0};
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	static int K;
	public static void main(String[] args) {
		int N=sc.nextInt();
		ArrayList<Integer> cc = new ArrayList<>(N);
		for(int i=0;i<N;i++) {
			cc.add(sc.nextInt());
		}
		Collections.sort(cc);
		Collections.reverse(cc);
		int ans1=0;
		int ans2=0;
		for(int i=1;i<=N;i++) {
			if(i%2==1) {
				ans1+=cc.get(i-1);
			}else {
				ans2+=cc.get(i-1);
			}
		}
		p(ans1-ans2);
	}
}
