import java.util.Scanner;
import java.util.Arrays;
import java.util.Comparator;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Integer[] data = new Integer[N];
		for (int i = 0; i < N; i++) {
			data[i] = sc.nextInt();
		}

		Arrays.sort(data, Comparator.reverseOrder());

		int Alice = 0;
		int Bob = 0;

		for (int i = 0; i < data.length; i++) {
			if (i % 2 == 0) {
				Alice += data[i];
			} else {
				Bob += data[i];
			}
		}
		
		System.out.println(Alice - Bob);

		sc.close();
	}

} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util import java.util.Comparator; Comparator java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Integer[] data = new Integer[N];
		for (int i = 0; i < N; i++) {
			data[i] = sc.nextInt();
		}

		Arrays.sort(data, Comparator.reverseOrder());

		int Alice = 0;
		int Bob = 0;

		for (int i = 0; i < data.length; i++) {
			if (i % 2 == 0) {
				Alice += data[i];
			} else {
				Bob += data[i];
			}
		}
		
		System.out.println(Alice - Bob);

		sc.close();
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Integer[] data = new Integer[N];
		for (int i = 0; i < N; i++) {
			data[i] = sc.nextInt();
		}

		Arrays.sort(data, Comparator.reverseOrder());

		int Alice = 0;
		int Bob = 0;

		for (int i = 0; i < data.length; i++) {
			if (i % 2 == 0) {
				Alice += data[i];
			} else {
				Bob += data[i];
			}
		}
		
		System.out.println(Alice - Bob);

		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Integer[] data = new Integer[N];
		for (int i = 0; i < N; i++) {
			data[i] = sc.nextInt();
		}

		Arrays.sort(data, Comparator.reverseOrder());

		int Alice = 0;
		int Bob = 0;

		for (int i = 0; i < data.length; i++) {
			if (i % 2 == 0) {
				Alice += data[i];
			} else {
				Bob += data[i];
			}
		}
		
		System.out.println(Alice - Bob);

		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc Integer[] data = new Integer[N]; data new Integer[N] N for (int i = 0; i < N; i++) {
			data[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			data[i] = sc.nextInt();
		} {
			data[i] = sc.nextInt();
		} data[i] = sc.nextInt() data[i] data i sc.nextInt() sc.nextInt sc Arrays.sort(data, Comparator.reverseOrder()) Arrays.sort Arrays data Comparator.reverseOrder() Comparator.reverseOrder Comparator int Alice = 0; Alice 0 int Bob = 0; Bob 0 for (int i = 0; i < data.length; i++) {
			if (i % 2 == 0) {
				Alice += data[i];
			} else {
				Bob += data[i];
			}
		} int i = 0; int i = 0; i 0 i < data.length i data.length data data.length i++ i++ i {
			if (i % 2 == 0) {
				Alice += data[i];
			} else {
				Bob += data[i];
			}
		} {
			if (i % 2 == 0) {
				Alice += data[i];
			} else {
				Bob += data[i];
			}
		} if (i % 2 == 0) {
				Alice += data[i];
			} else {
				Bob += data[i];
			} i % 2 == 0 i % 2 i 2 0 {
				Alice += data[i];
			} Alice += data[i] Alice data[i] data i {
				Bob += data[i];
			} Bob += data[i] Bob data[i] data i System.out.println(Alice - Bob) System.out.println System.out System System.out Alice - Bob Alice Bob sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Integer[] data = new Integer[N];
		for (int i = 0; i < N; i++) {
			data[i] = sc.nextInt();
		}

		Arrays.sort(data, Comparator.reverseOrder());

		int Alice = 0;
		int Bob = 0;

		for (int i = 0; i < data.length; i++) {
			if (i % 2 == 0) {
				Alice += data[i];
			} else {
				Bob += data[i];
			}
		}
		
		System.out.println(Alice - Bob);

		sc.close();
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Integer[] data = new Integer[N];
		for (int i = 0; i < N; i++) {
			data[i] = sc.nextInt();
		}

		Arrays.sort(data, Comparator.reverseOrder());

		int Alice = 0;
		int Bob = 0;

		for (int i = 0; i < data.length; i++) {
			if (i % 2 == 0) {
				Alice += data[i];
			} else {
				Bob += data[i];
			}
		}
		
		System.out.println(Alice - Bob);

		sc.close();
	}

} Main
import java.util.Scanner;
import java.util.Arrays;
import java.util.Comparator;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Integer[] data = new Integer[N];
		for (int i = 0; i < N; i++) {
			data[i] = sc.nextInt();
		}

		Arrays.sort(data, Comparator.reverseOrder());

		int Alice = 0;
		int Bob = 0;

		for (int i = 0; i < data.length; i++) {
			if (i % 2 == 0) {
				Alice += data[i];
			} else {
				Bob += data[i];
			}
		}
		
		System.out.println(Alice - Bob);

		sc.close();
	}

}