import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		final int n = sc.nextInt();

		List<Integer> list = new ArrayList<Integer>();

		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}

		Collections.sort(list);
		Collections.reverse(list);

		int alicePoint = 0;
		int bobPoint = 0;
		for (int j = 0; j < n; j++) {
			if ((j + 1) % 2 != 0) {
				alicePoint = alicePoint + list.get(j);
			} else {
				bobPoint = bobPoint + list.get(j);
			}
		}

		System.out.println(alicePoint - bobPoint);

	}

} import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		final int n = sc.nextInt();

		List<Integer> list = new ArrayList<Integer>();

		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}

		Collections.sort(list);
		Collections.reverse(list);

		int alicePoint = 0;
		int bobPoint = 0;
		for (int j = 0; j < n; j++) {
			if ((j + 1) % 2 != 0) {
				alicePoint = alicePoint + list.get(j);
			} else {
				bobPoint = bobPoint + list.get(j);
			}
		}

		System.out.println(alicePoint - bobPoint);

	}

} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		final int n = sc.nextInt();

		List<Integer> list = new ArrayList<Integer>();

		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}

		Collections.sort(list);
		Collections.reverse(list);

		int alicePoint = 0;
		int bobPoint = 0;
		for (int j = 0; j < n; j++) {
			if ((j + 1) % 2 != 0) {
				alicePoint = alicePoint + list.get(j);
			} else {
				bobPoint = bobPoint + list.get(j);
			}
		}

		System.out.println(alicePoint - bobPoint);

	} main {

		Scanner sc = new Scanner(System.in);

		final int n = sc.nextInt();

		List<Integer> list = new ArrayList<Integer>();

		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}

		Collections.sort(list);
		Collections.reverse(list);

		int alicePoint = 0;
		int bobPoint = 0;
		for (int j = 0; j < n; j++) {
			if ((j + 1) % 2 != 0) {
				alicePoint = alicePoint + list.get(j);
			} else {
				bobPoint = bobPoint + list.get(j);
			}
		}

		System.out.println(alicePoint - bobPoint);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) final int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc List<Integer> list = new ArrayList<Integer>(); list new ArrayList<Integer>() for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			list.add(sc.nextInt());
		} {
			list.add(sc.nextInt());
		} list.add(sc.nextInt()) list.add list sc.nextInt() sc.nextInt sc Collections.sort(list) Collections.sort Collections list Collections.reverse(list) Collections.reverse Collections list int alicePoint = 0; alicePoint 0 int bobPoint = 0; bobPoint 0 for (int j = 0; j < n; j++) {
			if ((j + 1) % 2 != 0) {
				alicePoint = alicePoint + list.get(j);
			} else {
				bobPoint = bobPoint + list.get(j);
			}
		} int j = 0; int j = 0; j 0 j < n j n j++ j++ j {
			if ((j + 1) % 2 != 0) {
				alicePoint = alicePoint + list.get(j);
			} else {
				bobPoint = bobPoint + list.get(j);
			}
		} {
			if ((j + 1) % 2 != 0) {
				alicePoint = alicePoint + list.get(j);
			} else {
				bobPoint = bobPoint + list.get(j);
			}
		} if ((j + 1) % 2 != 0) {
				alicePoint = alicePoint + list.get(j);
			} else {
				bobPoint = bobPoint + list.get(j);
			} (j + 1) % 2 != 0 (j + 1) % 2 (j + 1) j 1 2 0 {
				alicePoint = alicePoint + list.get(j);
			} alicePoint = alicePoint + list.get(j) alicePoint alicePoint + list.get(j) alicePoint list.get(j) list.get list j {
				bobPoint = bobPoint + list.get(j);
			} bobPoint = bobPoint + list.get(j) bobPoint bobPoint + list.get(j) bobPoint list.get(j) list.get list j System.out.println(alicePoint - bobPoint) System.out.println System.out System System.out alicePoint - bobPoint alicePoint bobPoint String[] args args public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		final int n = sc.nextInt();

		List<Integer> list = new ArrayList<Integer>();

		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}

		Collections.sort(list);
		Collections.reverse(list);

		int alicePoint = 0;
		int bobPoint = 0;
		for (int j = 0; j < n; j++) {
			if ((j + 1) % 2 != 0) {
				alicePoint = alicePoint + list.get(j);
			} else {
				bobPoint = bobPoint + list.get(j);
			}
		}

		System.out.println(alicePoint - bobPoint);

	}

} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		final int n = sc.nextInt();

		List<Integer> list = new ArrayList<Integer>();

		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}

		Collections.sort(list);
		Collections.reverse(list);

		int alicePoint = 0;
		int bobPoint = 0;
		for (int j = 0; j < n; j++) {
			if ((j + 1) % 2 != 0) {
				alicePoint = alicePoint + list.get(j);
			} else {
				bobPoint = bobPoint + list.get(j);
			}
		}

		System.out.println(alicePoint - bobPoint);

	}

} Main
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		final int n = sc.nextInt();

		List<Integer> list = new ArrayList<Integer>();

		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}

		Collections.sort(list);
		Collections.reverse(list);

		int alicePoint = 0;
		int bobPoint = 0;
		for (int j = 0; j < n; j++) {
			if ((j + 1) % 2 != 0) {
				alicePoint = alicePoint + list.get(j);
			} else {
				bobPoint = bobPoint + list.get(j);
			}
		}

		System.out.println(alicePoint - bobPoint);

	}

}
