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

public class Main {

	public static void main(String[] args) {

		Integer[] scanResult = scan();
		Arrays.sort(scanResult, Comparator.reverseOrder());

		System.out.println(calc(scanResult));
	}

	private static Integer[] scan() {

		Scanner sc = new Scanner(System.in);
		int size = sc.nextInt();
		Integer[] arr = new Integer[size];
		for (int i = 0; i < size; i++) {
			arr[i] = sc.nextInt();
		}
		return arr;
	}

	private static int calc(Integer[] arr) {

		int aliceTotal = 0;
		int bobTotal = 0;

		for (int i = 0; i < arr.length; i++) {

			if (i % 2 == 0) {
				aliceTotal += arr[i];
			} else {
				bobTotal += arr[i];
			}
		}
		return aliceTotal - bobTotal;
	}
} import java.util.Arrays; Arrays java.util import java.util.Comparator; Comparator java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		Integer[] scanResult = scan();
		Arrays.sort(scanResult, Comparator.reverseOrder());

		System.out.println(calc(scanResult));
	}

	private static Integer[] scan() {

		Scanner sc = new Scanner(System.in);
		int size = sc.nextInt();
		Integer[] arr = new Integer[size];
		for (int i = 0; i < size; i++) {
			arr[i] = sc.nextInt();
		}
		return arr;
	}

	private static int calc(Integer[] arr) {

		int aliceTotal = 0;
		int bobTotal = 0;

		for (int i = 0; i < arr.length; i++) {

			if (i % 2 == 0) {
				aliceTotal += arr[i];
			} else {
				bobTotal += arr[i];
			}
		}
		return aliceTotal - bobTotal;
	}
} Main public static void main(String[] args) {

		Integer[] scanResult = scan();
		Arrays.sort(scanResult, Comparator.reverseOrder());

		System.out.println(calc(scanResult));
	} main {

		Integer[] scanResult = scan();
		Arrays.sort(scanResult, Comparator.reverseOrder());

		System.out.println(calc(scanResult));
	} Integer[] scanResult = scan(); scanResult scan() scan Arrays.sort(scanResult, Comparator.reverseOrder()) Arrays.sort Arrays scanResult Comparator.reverseOrder() Comparator.reverseOrder Comparator System.out.println(calc(scanResult)) System.out.println System.out System System.out calc(scanResult) calc scanResult String[] args args private static Integer[] scan() {

		Scanner sc = new Scanner(System.in);
		int size = sc.nextInt();
		Integer[] arr = new Integer[size];
		for (int i = 0; i < size; i++) {
			arr[i] = sc.nextInt();
		}
		return arr;
	} scan {

		Scanner sc = new Scanner(System.in);
		int size = sc.nextInt();
		Integer[] arr = new Integer[size];
		for (int i = 0; i < size; i++) {
			arr[i] = sc.nextInt();
		}
		return arr;
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int size = sc.nextInt(); size sc.nextInt() sc.nextInt sc Integer[] arr = new Integer[size]; arr new Integer[size] size for (int i = 0; i < size; i++) {
			arr[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < size i size i++ i++ i {
			arr[i] = sc.nextInt();
		} {
			arr[i] = sc.nextInt();
		} arr[i] = sc.nextInt() arr[i] arr i sc.nextInt() sc.nextInt sc return arr; arr private static int calc(Integer[] arr) {

		int aliceTotal = 0;
		int bobTotal = 0;

		for (int i = 0; i < arr.length; i++) {

			if (i % 2 == 0) {
				aliceTotal += arr[i];
			} else {
				bobTotal += arr[i];
			}
		}
		return aliceTotal - bobTotal;
	} calc {

		int aliceTotal = 0;
		int bobTotal = 0;

		for (int i = 0; i < arr.length; i++) {

			if (i % 2 == 0) {
				aliceTotal += arr[i];
			} else {
				bobTotal += arr[i];
			}
		}
		return aliceTotal - bobTotal;
	} int aliceTotal = 0; aliceTotal 0 int bobTotal = 0; bobTotal 0 for (int i = 0; i < arr.length; i++) {

			if (i % 2 == 0) {
				aliceTotal += arr[i];
			} else {
				bobTotal += arr[i];
			}
		} int i = 0; int i = 0; i 0 i < arr.length i arr.length arr arr.length i++ i++ i {

			if (i % 2 == 0) {
				aliceTotal += arr[i];
			} else {
				bobTotal += arr[i];
			}
		} {

			if (i % 2 == 0) {
				aliceTotal += arr[i];
			} else {
				bobTotal += arr[i];
			}
		} if (i % 2 == 0) {
				aliceTotal += arr[i];
			} else {
				bobTotal += arr[i];
			} i % 2 == 0 i % 2 i 2 0 {
				aliceTotal += arr[i];
			} aliceTotal += arr[i] aliceTotal arr[i] arr i {
				bobTotal += arr[i];
			} bobTotal += arr[i] bobTotal arr[i] arr i return aliceTotal - bobTotal; aliceTotal - bobTotal aliceTotal bobTotal Integer[] arr arr public class Main {

	public static void main(String[] args) {

		Integer[] scanResult = scan();
		Arrays.sort(scanResult, Comparator.reverseOrder());

		System.out.println(calc(scanResult));
	}

	private static Integer[] scan() {

		Scanner sc = new Scanner(System.in);
		int size = sc.nextInt();
		Integer[] arr = new Integer[size];
		for (int i = 0; i < size; i++) {
			arr[i] = sc.nextInt();
		}
		return arr;
	}

	private static int calc(Integer[] arr) {

		int aliceTotal = 0;
		int bobTotal = 0;

		for (int i = 0; i < arr.length; i++) {

			if (i % 2 == 0) {
				aliceTotal += arr[i];
			} else {
				bobTotal += arr[i];
			}
		}
		return aliceTotal - bobTotal;
	}
} public class Main {

	public static void main(String[] args) {

		Integer[] scanResult = scan();
		Arrays.sort(scanResult, Comparator.reverseOrder());

		System.out.println(calc(scanResult));
	}

	private static Integer[] scan() {

		Scanner sc = new Scanner(System.in);
		int size = sc.nextInt();
		Integer[] arr = new Integer[size];
		for (int i = 0; i < size; i++) {
			arr[i] = sc.nextInt();
		}
		return arr;
	}

	private static int calc(Integer[] arr) {

		int aliceTotal = 0;
		int bobTotal = 0;

		for (int i = 0; i < arr.length; i++) {

			if (i % 2 == 0) {
				aliceTotal += arr[i];
			} else {
				bobTotal += arr[i];
			}
		}
		return aliceTotal - bobTotal;
	}
} Main
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Integer[] scanResult = scan();
		Arrays.sort(scanResult, Comparator.reverseOrder());

		System.out.println(calc(scanResult));
	}

	private static Integer[] scan() {

		Scanner sc = new Scanner(System.in);
		int size = sc.nextInt();
		Integer[] arr = new Integer[size];
		for (int i = 0; i < size; i++) {
			arr[i] = sc.nextInt();
		}
		return arr;
	}

	private static int calc(Integer[] arr) {

		int aliceTotal = 0;
		int bobTotal = 0;

		for (int i = 0; i < arr.length; i++) {

			if (i % 2 == 0) {
				aliceTotal += arr[i];
			} else {
				bobTotal += arr[i];
			}
		}
		return aliceTotal - bobTotal;
	}
}