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[] array = new int[n];
		int alice = 0;
		int bob = 0;

		for(int i = 0; i < array.length; i++) {
			array[i] = sc.nextInt();
		}
		Arrays.sort(array);

		alice = rep(array,1);
		bob = rep(array,2);
		
		System.out.println(alice-bob);
	}
	static int rep(int[] array,int num) {
		int sum = 0;
		for(int i = array.length-num; i >= 0; i-=2) {
			sum += array[i];
		}
		return sum;
	}
} 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[] array = new int[n];
		int alice = 0;
		int bob = 0;

		for(int i = 0; i < array.length; i++) {
			array[i] = sc.nextInt();
		}
		Arrays.sort(array);

		alice = rep(array,1);
		bob = rep(array,2);
		
		System.out.println(alice-bob);
	}
	static int rep(int[] array,int num) {
		int sum = 0;
		for(int i = array.length-num; i >= 0; i-=2) {
			sum += array[i];
		}
		return sum;
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] array = new int[n];
		int alice = 0;
		int bob = 0;

		for(int i = 0; i < array.length; i++) {
			array[i] = sc.nextInt();
		}
		Arrays.sort(array);

		alice = rep(array,1);
		bob = rep(array,2);
		
		System.out.println(alice-bob);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] array = new int[n];
		int alice = 0;
		int bob = 0;

		for(int i = 0; i < array.length; i++) {
			array[i] = sc.nextInt();
		}
		Arrays.sort(array);

		alice = rep(array,1);
		bob = rep(array,2);
		
		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[] array = new int[n]; array new int[n] n int alice = 0; alice 0 int bob = 0; bob 0 for(int i = 0; i < array.length; i++) {
			array[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < array.length i array.length array array.length i++ i++ i {
			array[i] = sc.nextInt();
		} {
			array[i] = sc.nextInt();
		} array[i] = sc.nextInt() array[i] array i sc.nextInt() sc.nextInt sc Arrays.sort(array) Arrays.sort Arrays array alice = rep(array,1) alice rep(array,1) rep array 1 bob = rep(array,2) bob rep(array,2) rep array 2 System.out.println(alice-bob) System.out.println System.out System System.out alice-bob alice bob String[] args args static int rep(int[] array,int num) {
		int sum = 0;
		for(int i = array.length-num; i >= 0; i-=2) {
			sum += array[i];
		}
		return sum;
	} rep {
		int sum = 0;
		for(int i = array.length-num; i >= 0; i-=2) {
			sum += array[i];
		}
		return sum;
	} int sum = 0; sum 0 for(int i = array.length-num; i >= 0; i-=2) {
			sum += array[i];
		} int i = array.length-num; int i = array.length-num; i array.length-num array.length array array.length num i >= 0 i 0 i-=2 i-=2 i 2 {
			sum += array[i];
		} {
			sum += array[i];
		} sum += array[i] sum array[i] array i return sum; sum int[] array array int num num public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] array = new int[n];
		int alice = 0;
		int bob = 0;

		for(int i = 0; i < array.length; i++) {
			array[i] = sc.nextInt();
		}
		Arrays.sort(array);

		alice = rep(array,1);
		bob = rep(array,2);
		
		System.out.println(alice-bob);
	}
	static int rep(int[] array,int num) {
		int sum = 0;
		for(int i = array.length-num; i >= 0; i-=2) {
			sum += array[i];
		}
		return sum;
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] array = new int[n];
		int alice = 0;
		int bob = 0;

		for(int i = 0; i < array.length; i++) {
			array[i] = sc.nextInt();
		}
		Arrays.sort(array);

		alice = rep(array,1);
		bob = rep(array,2);
		
		System.out.println(alice-bob);
	}
	static int rep(int[] array,int num) {
		int sum = 0;
		for(int i = array.length-num; i >= 0; i-=2) {
			sum += array[i];
		}
		return sum;
	}
} 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[] array = new int[n];
		int alice = 0;
		int bob = 0;

		for(int i = 0; i < array.length; i++) {
			array[i] = sc.nextInt();
		}
		Arrays.sort(array);

		alice = rep(array,1);
		bob = rep(array,2);
		
		System.out.println(alice-bob);
	}
	static int rep(int[] array,int num) {
		int sum = 0;
		for(int i = array.length-num; i >= 0; i-=2) {
			sum += array[i];
		}
		return sum;
	}
}
