import java.util.Arrays;
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] card= new int[n];
		for(int i = 0; i < n; i++){
			card[i] = sc.nextInt();
		}
		Arrays.sort(card);
		int alice = 0;
		int bob = 0;
		for(int i = card.length - 1; i >= 0; i--){
			alice += card[i];
			i--;
			if(i >= 0){
				bob += card[i];
			}
		}
		System.out.println(alice - bob);
 	}
}

 import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] card= new int[n];
		for(int i = 0; i < n; i++){
			card[i] = sc.nextInt();
		}
		Arrays.sort(card);
		int alice = 0;
		int bob = 0;
		for(int i = card.length - 1; i >= 0; i--){
			alice += card[i];
			i--;
			if(i >= 0){
				bob += card[i];
			}
		}
		System.out.println(alice - bob);
 	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] card= new int[n];
		for(int i = 0; i < n; i++){
			card[i] = sc.nextInt();
		}
		Arrays.sort(card);
		int alice = 0;
		int bob = 0;
		for(int i = card.length - 1; i >= 0; i--){
			alice += card[i];
			i--;
			if(i >= 0){
				bob += card[i];
			}
		}
		System.out.println(alice - bob);
 	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] card= new int[n];
		for(int i = 0; i < n; i++){
			card[i] = sc.nextInt();
		}
		Arrays.sort(card);
		int alice = 0;
		int bob = 0;
		for(int i = card.length - 1; i >= 0; i--){
			alice += card[i];
			i--;
			if(i >= 0){
				bob += card[i];
			}
		}
		System.out.println(alice - bob);
 	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] card= new int[n]; card new int[n] n for(int i = 0; i < n; i++){
			card[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			card[i] = sc.nextInt();
		} {
			card[i] = sc.nextInt();
		} card[i] = sc.nextInt() card[i] card i sc.nextInt() sc.nextInt sc Arrays.sort(card) Arrays.sort Arrays card int alice = 0; alice 0 int bob = 0; bob 0 for(int i = card.length - 1; i >= 0; i--){
			alice += card[i];
			i--;
			if(i >= 0){
				bob += card[i];
			}
		} int i = card.length - 1; int i = card.length - 1; i card.length - 1 card.length card card.length 1 i >= 0 i 0 i-- i-- i {
			alice += card[i];
			i--;
			if(i >= 0){
				bob += card[i];
			}
		} {
			alice += card[i];
			i--;
			if(i >= 0){
				bob += card[i];
			}
		} alice += card[i] alice card[i] card i i-- i if(i >= 0){
				bob += card[i];
			} i >= 0 i 0 {
				bob += card[i];
			} bob += card[i] bob card[i] card i System.out.println(alice - bob) System.out.println System.out System System.out alice - bob alice bob String[] args args public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] card= new int[n];
		for(int i = 0; i < n; i++){
			card[i] = sc.nextInt();
		}
		Arrays.sort(card);
		int alice = 0;
		int bob = 0;
		for(int i = card.length - 1; i >= 0; i--){
			alice += card[i];
			i--;
			if(i >= 0){
				bob += card[i];
			}
		}
		System.out.println(alice - bob);
 	}
} public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] card= new int[n];
		for(int i = 0; i < n; i++){
			card[i] = sc.nextInt();
		}
		Arrays.sort(card);
		int alice = 0;
		int bob = 0;
		for(int i = card.length - 1; i >= 0; i--){
			alice += card[i];
			i--;
			if(i >= 0){
				bob += card[i];
			}
		}
		System.out.println(alice - bob);
 	}
} Main
import java.util.Arrays;
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] card= new int[n];
		for(int i = 0; i < n; i++){
			card[i] = sc.nextInt();
		}
		Arrays.sort(card);
		int alice = 0;
		int bob = 0;
		for(int i = card.length - 1; i >= 0; i--){
			alice += card[i];
			i--;
			if(i >= 0){
				bob += card[i];
			}
		}
		System.out.println(alice - bob);
 	}
}


