import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int numOfSheets = sc.nextInt();
		int[] numArray = new int[numOfSheets];
		for(int i = 0; i < numOfSheets; i++) {
			numArray[i] = sc.nextInt();
		}
		int[] sortArray = new int[numArray.length];
		int Alice = 0;
		int Bob = 0;
		for (int i = 0; i < numArray.length; i++) {
			int placeNum = 0;
			sortArray[i] = 0;
			for (int j = 0; j < sortArray.length; j++) {
				if(sortArray[i] < numArray[j]) {
					sortArray[i] = numArray[j];
					placeNum = j;
				}
			}
			numArray[placeNum] = 0;
			if(i % 2 == 0) {
				Alice += sortArray[i];
			}else {
				Bob += sortArray[i];
			}
		}
		System.out.print(Alice - Bob);
	}
} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int numOfSheets = sc.nextInt();
		int[] numArray = new int[numOfSheets];
		for(int i = 0; i < numOfSheets; i++) {
			numArray[i] = sc.nextInt();
		}
		int[] sortArray = new int[numArray.length];
		int Alice = 0;
		int Bob = 0;
		for (int i = 0; i < numArray.length; i++) {
			int placeNum = 0;
			sortArray[i] = 0;
			for (int j = 0; j < sortArray.length; j++) {
				if(sortArray[i] < numArray[j]) {
					sortArray[i] = numArray[j];
					placeNum = j;
				}
			}
			numArray[placeNum] = 0;
			if(i % 2 == 0) {
				Alice += sortArray[i];
			}else {
				Bob += sortArray[i];
			}
		}
		System.out.print(Alice - Bob);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int numOfSheets = sc.nextInt();
		int[] numArray = new int[numOfSheets];
		for(int i = 0; i < numOfSheets; i++) {
			numArray[i] = sc.nextInt();
		}
		int[] sortArray = new int[numArray.length];
		int Alice = 0;
		int Bob = 0;
		for (int i = 0; i < numArray.length; i++) {
			int placeNum = 0;
			sortArray[i] = 0;
			for (int j = 0; j < sortArray.length; j++) {
				if(sortArray[i] < numArray[j]) {
					sortArray[i] = numArray[j];
					placeNum = j;
				}
			}
			numArray[placeNum] = 0;
			if(i % 2 == 0) {
				Alice += sortArray[i];
			}else {
				Bob += sortArray[i];
			}
		}
		System.out.print(Alice - Bob);
	} main {
		Scanner sc = new Scanner(System.in);
		int numOfSheets = sc.nextInt();
		int[] numArray = new int[numOfSheets];
		for(int i = 0; i < numOfSheets; i++) {
			numArray[i] = sc.nextInt();
		}
		int[] sortArray = new int[numArray.length];
		int Alice = 0;
		int Bob = 0;
		for (int i = 0; i < numArray.length; i++) {
			int placeNum = 0;
			sortArray[i] = 0;
			for (int j = 0; j < sortArray.length; j++) {
				if(sortArray[i] < numArray[j]) {
					sortArray[i] = numArray[j];
					placeNum = j;
				}
			}
			numArray[placeNum] = 0;
			if(i % 2 == 0) {
				Alice += sortArray[i];
			}else {
				Bob += sortArray[i];
			}
		}
		System.out.print(Alice - Bob);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int numOfSheets = sc.nextInt(); numOfSheets sc.nextInt() sc.nextInt sc int[] numArray = new int[numOfSheets]; numArray new int[numOfSheets] numOfSheets for(int i = 0; i < numOfSheets; i++) {
			numArray[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < numOfSheets i numOfSheets i++ i++ i {
			numArray[i] = sc.nextInt();
		} {
			numArray[i] = sc.nextInt();
		} numArray[i] = sc.nextInt() numArray[i] numArray i sc.nextInt() sc.nextInt sc int[] sortArray = new int[numArray.length]; sortArray new int[numArray.length] numArray.length numArray numArray.length int Alice = 0; Alice 0 int Bob = 0; Bob 0 for (int i = 0; i < numArray.length; i++) {
			int placeNum = 0;
			sortArray[i] = 0;
			for (int j = 0; j < sortArray.length; j++) {
				if(sortArray[i] < numArray[j]) {
					sortArray[i] = numArray[j];
					placeNum = j;
				}
			}
			numArray[placeNum] = 0;
			if(i % 2 == 0) {
				Alice += sortArray[i];
			}else {
				Bob += sortArray[i];
			}
		} int i = 0; int i = 0; i 0 i < numArray.length i numArray.length numArray numArray.length i++ i++ i {
			int placeNum = 0;
			sortArray[i] = 0;
			for (int j = 0; j < sortArray.length; j++) {
				if(sortArray[i] < numArray[j]) {
					sortArray[i] = numArray[j];
					placeNum = j;
				}
			}
			numArray[placeNum] = 0;
			if(i % 2 == 0) {
				Alice += sortArray[i];
			}else {
				Bob += sortArray[i];
			}
		} {
			int placeNum = 0;
			sortArray[i] = 0;
			for (int j = 0; j < sortArray.length; j++) {
				if(sortArray[i] < numArray[j]) {
					sortArray[i] = numArray[j];
					placeNum = j;
				}
			}
			numArray[placeNum] = 0;
			if(i % 2 == 0) {
				Alice += sortArray[i];
			}else {
				Bob += sortArray[i];
			}
		} int placeNum = 0; placeNum 0 sortArray[i] = 0 sortArray[i] sortArray i 0 for (int j = 0; j < sortArray.length; j++) {
				if(sortArray[i] < numArray[j]) {
					sortArray[i] = numArray[j];
					placeNum = j;
				}
			} int j = 0; int j = 0; j 0 j < sortArray.length j sortArray.length sortArray sortArray.length j++ j++ j {
				if(sortArray[i] < numArray[j]) {
					sortArray[i] = numArray[j];
					placeNum = j;
				}
			} {
				if(sortArray[i] < numArray[j]) {
					sortArray[i] = numArray[j];
					placeNum = j;
				}
			} if(sortArray[i] < numArray[j]) {
					sortArray[i] = numArray[j];
					placeNum = j;
				} sortArray[i] < numArray[j] sortArray[i] sortArray i numArray[j] numArray j {
					sortArray[i] = numArray[j];
					placeNum = j;
				} sortArray[i] = numArray[j] sortArray[i] sortArray i numArray[j] numArray j placeNum = j placeNum j numArray[placeNum] = 0 numArray[placeNum] numArray placeNum 0 if(i % 2 == 0) {
				Alice += sortArray[i];
			}else {
				Bob += sortArray[i];
			} i % 2 == 0 i % 2 i 2 0 {
				Alice += sortArray[i];
			} Alice += sortArray[i] Alice sortArray[i] sortArray i {
				Bob += sortArray[i];
			} Bob += sortArray[i] Bob sortArray[i] sortArray i System.out.print(Alice - Bob) System.out.print 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 numOfSheets = sc.nextInt();
		int[] numArray = new int[numOfSheets];
		for(int i = 0; i < numOfSheets; i++) {
			numArray[i] = sc.nextInt();
		}
		int[] sortArray = new int[numArray.length];
		int Alice = 0;
		int Bob = 0;
		for (int i = 0; i < numArray.length; i++) {
			int placeNum = 0;
			sortArray[i] = 0;
			for (int j = 0; j < sortArray.length; j++) {
				if(sortArray[i] < numArray[j]) {
					sortArray[i] = numArray[j];
					placeNum = j;
				}
			}
			numArray[placeNum] = 0;
			if(i % 2 == 0) {
				Alice += sortArray[i];
			}else {
				Bob += sortArray[i];
			}
		}
		System.out.print(Alice - Bob);
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int numOfSheets = sc.nextInt();
		int[] numArray = new int[numOfSheets];
		for(int i = 0; i < numOfSheets; i++) {
			numArray[i] = sc.nextInt();
		}
		int[] sortArray = new int[numArray.length];
		int Alice = 0;
		int Bob = 0;
		for (int i = 0; i < numArray.length; i++) {
			int placeNum = 0;
			sortArray[i] = 0;
			for (int j = 0; j < sortArray.length; j++) {
				if(sortArray[i] < numArray[j]) {
					sortArray[i] = numArray[j];
					placeNum = j;
				}
			}
			numArray[placeNum] = 0;
			if(i % 2 == 0) {
				Alice += sortArray[i];
			}else {
				Bob += sortArray[i];
			}
		}
		System.out.print(Alice - Bob);
	}
} Main
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int numOfSheets = sc.nextInt();
		int[] numArray = new int[numOfSheets];
		for(int i = 0; i < numOfSheets; i++) {
			numArray[i] = sc.nextInt();
		}
		int[] sortArray = new int[numArray.length];
		int Alice = 0;
		int Bob = 0;
		for (int i = 0; i < numArray.length; i++) {
			int placeNum = 0;
			sortArray[i] = 0;
			for (int j = 0; j < sortArray.length; j++) {
				if(sortArray[i] < numArray[j]) {
					sortArray[i] = numArray[j];
					placeNum = j;
				}
			}
			numArray[placeNum] = 0;
			if(i % 2 == 0) {
				Alice += sortArray[i];
			}else {
				Bob += sortArray[i];
			}
		}
		System.out.print(Alice - Bob);
	}
}
