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

public class Main {
	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int N = scanner.nextInt();
			List<Integer> integers = new ArrayList<Integer>();
			for (int i = 0; i < N; i++) {
				integers.add(scanner.nextInt());
			}
			// reverse sort
			Collections.sort(integers, Comparator.reverseOrder());

			int alice = 0;
			int bob = 0;
			for (int i = 0; i < integers.size(); i++) {
				if (i % 2 == 0) {
					alice += Integer.valueOf(integers.get(i));
				} else {
					bob += Integer.valueOf(integers.get(i));
				}
			}
			System.out.println(alice - bob);
		}
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.Comparator; Comparator 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) {
		try (Scanner scanner = new Scanner(System.in)) {
			int N = scanner.nextInt();
			List<Integer> integers = new ArrayList<Integer>();
			for (int i = 0; i < N; i++) {
				integers.add(scanner.nextInt());
			}
			// reverse sort
			Collections.sort(integers, Comparator.reverseOrder());

			int alice = 0;
			int bob = 0;
			for (int i = 0; i < integers.size(); i++) {
				if (i % 2 == 0) {
					alice += Integer.valueOf(integers.get(i));
				} else {
					bob += Integer.valueOf(integers.get(i));
				}
			}
			System.out.println(alice - bob);
		}
	}
} Main public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int N = scanner.nextInt();
			List<Integer> integers = new ArrayList<Integer>();
			for (int i = 0; i < N; i++) {
				integers.add(scanner.nextInt());
			}
			// reverse sort
			Collections.sort(integers, Comparator.reverseOrder());

			int alice = 0;
			int bob = 0;
			for (int i = 0; i < integers.size(); i++) {
				if (i % 2 == 0) {
					alice += Integer.valueOf(integers.get(i));
				} else {
					bob += Integer.valueOf(integers.get(i));
				}
			}
			System.out.println(alice - bob);
		}
	} main {
		try (Scanner scanner = new Scanner(System.in)) {
			int N = scanner.nextInt();
			List<Integer> integers = new ArrayList<Integer>();
			for (int i = 0; i < N; i++) {
				integers.add(scanner.nextInt());
			}
			// reverse sort
			Collections.sort(integers, Comparator.reverseOrder());

			int alice = 0;
			int bob = 0;
			for (int i = 0; i < integers.size(); i++) {
				if (i % 2 == 0) {
					alice += Integer.valueOf(integers.get(i));
				} else {
					bob += Integer.valueOf(integers.get(i));
				}
			}
			System.out.println(alice - bob);
		}
	} try (Scanner scanner = new Scanner(System.in)) {
			int N = scanner.nextInt();
			List<Integer> integers = new ArrayList<Integer>();
			for (int i = 0; i < N; i++) {
				integers.add(scanner.nextInt());
			}
			// reverse sort
			Collections.sort(integers, Comparator.reverseOrder());

			int alice = 0;
			int bob = 0;
			for (int i = 0; i < integers.size(); i++) {
				if (i % 2 == 0) {
					alice += Integer.valueOf(integers.get(i));
				} else {
					bob += Integer.valueOf(integers.get(i));
				}
			}
			System.out.println(alice - bob);
		} {
			int N = scanner.nextInt();
			List<Integer> integers = new ArrayList<Integer>();
			for (int i = 0; i < N; i++) {
				integers.add(scanner.nextInt());
			}
			// reverse sort
			Collections.sort(integers, Comparator.reverseOrder());

			int alice = 0;
			int bob = 0;
			for (int i = 0; i < integers.size(); i++) {
				if (i % 2 == 0) {
					alice += Integer.valueOf(integers.get(i));
				} else {
					bob += Integer.valueOf(integers.get(i));
				}
			}
			System.out.println(alice - bob);
		} Scanner scanner = new Scanner(System.in) Scanner scanner = new Scanner(System.in) new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner List<Integer> integers = new ArrayList<Integer>(); integers new ArrayList<Integer>() for (int i = 0; i < N; i++) {
				integers.add(scanner.nextInt());
			} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
				integers.add(scanner.nextInt());
			} {
				integers.add(scanner.nextInt());
			} integers.add(scanner.nextInt()) integers.add integers scanner.nextInt() scanner.nextInt scanner Collections.sort(integers, Comparator.reverseOrder()) Collections.sort Collections integers Comparator.reverseOrder() Comparator.reverseOrder Comparator int alice = 0; alice 0 int bob = 0; bob 0 for (int i = 0; i < integers.size(); i++) {
				if (i % 2 == 0) {
					alice += Integer.valueOf(integers.get(i));
				} else {
					bob += Integer.valueOf(integers.get(i));
				}
			} int i = 0; int i = 0; i 0 i < integers.size() i integers.size() integers.size integers i++ i++ i {
				if (i % 2 == 0) {
					alice += Integer.valueOf(integers.get(i));
				} else {
					bob += Integer.valueOf(integers.get(i));
				}
			} {
				if (i % 2 == 0) {
					alice += Integer.valueOf(integers.get(i));
				} else {
					bob += Integer.valueOf(integers.get(i));
				}
			} if (i % 2 == 0) {
					alice += Integer.valueOf(integers.get(i));
				} else {
					bob += Integer.valueOf(integers.get(i));
				} i % 2 == 0 i % 2 i 2 0 {
					alice += Integer.valueOf(integers.get(i));
				} alice += Integer.valueOf(integers.get(i)) alice Integer.valueOf(integers.get(i)) Integer.valueOf Integer integers.get(i) integers.get integers i {
					bob += Integer.valueOf(integers.get(i));
				} bob += Integer.valueOf(integers.get(i)) bob Integer.valueOf(integers.get(i)) Integer.valueOf Integer integers.get(i) integers.get integers i System.out.println(alice - bob) System.out.println System.out System System.out alice - bob alice bob String[] args args public class Main {
	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int N = scanner.nextInt();
			List<Integer> integers = new ArrayList<Integer>();
			for (int i = 0; i < N; i++) {
				integers.add(scanner.nextInt());
			}
			// reverse sort
			Collections.sort(integers, Comparator.reverseOrder());

			int alice = 0;
			int bob = 0;
			for (int i = 0; i < integers.size(); i++) {
				if (i % 2 == 0) {
					alice += Integer.valueOf(integers.get(i));
				} else {
					bob += Integer.valueOf(integers.get(i));
				}
			}
			System.out.println(alice - bob);
		}
	}
} public class Main {
	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int N = scanner.nextInt();
			List<Integer> integers = new ArrayList<Integer>();
			for (int i = 0; i < N; i++) {
				integers.add(scanner.nextInt());
			}
			// reverse sort
			Collections.sort(integers, Comparator.reverseOrder());

			int alice = 0;
			int bob = 0;
			for (int i = 0; i < integers.size(); i++) {
				if (i % 2 == 0) {
					alice += Integer.valueOf(integers.get(i));
				} else {
					bob += Integer.valueOf(integers.get(i));
				}
			}
			System.out.println(alice - bob);
		}
	}
} Main
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int N = scanner.nextInt();
			List<Integer> integers = new ArrayList<Integer>();
			for (int i = 0; i < N; i++) {
				integers.add(scanner.nextInt());
			}
			// reverse sort
			Collections.sort(integers, Comparator.reverseOrder());

			int alice = 0;
			int bob = 0;
			for (int i = 0; i < integers.size(); i++) {
				if (i % 2 == 0) {
					alice += Integer.valueOf(integers.get(i));
				} else {
					bob += Integer.valueOf(integers.get(i));
				}
			}
			System.out.println(alice - bob);
		}
	}
}