import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		int Alice = 0;
		int Bob = 0;
		int N;
		ArrayList<Integer> cards = new ArrayList<Integer>();

		Scanner scan = new Scanner(System.in);
		N = scan.nextInt();

		for(int i = 0; i < N; i++) {
			cards.add(scan.nextInt());
		}

		Collections.sort(cards, Collections.reverseOrder());

		for(int i = 0; i < N; i+=2) {
			Alice += cards.get(i);
		}
		for(int i = 1; i < N; i+=2) {
			Bob += cards.get(i);
		}
		System.out.println(Alice - Bob);
		scan.close();
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		int Alice = 0;
		int Bob = 0;
		int N;
		ArrayList<Integer> cards = new ArrayList<Integer>();

		Scanner scan = new Scanner(System.in);
		N = scan.nextInt();

		for(int i = 0; i < N; i++) {
			cards.add(scan.nextInt());
		}

		Collections.sort(cards, Collections.reverseOrder());

		for(int i = 0; i < N; i+=2) {
			Alice += cards.get(i);
		}
		for(int i = 1; i < N; i+=2) {
			Bob += cards.get(i);
		}
		System.out.println(Alice - Bob);
		scan.close();
	}
} Main public static void main(String[] args) {
		int Alice = 0;
		int Bob = 0;
		int N;
		ArrayList<Integer> cards = new ArrayList<Integer>();

		Scanner scan = new Scanner(System.in);
		N = scan.nextInt();

		for(int i = 0; i < N; i++) {
			cards.add(scan.nextInt());
		}

		Collections.sort(cards, Collections.reverseOrder());

		for(int i = 0; i < N; i+=2) {
			Alice += cards.get(i);
		}
		for(int i = 1; i < N; i+=2) {
			Bob += cards.get(i);
		}
		System.out.println(Alice - Bob);
		scan.close();
	} main {
		int Alice = 0;
		int Bob = 0;
		int N;
		ArrayList<Integer> cards = new ArrayList<Integer>();

		Scanner scan = new Scanner(System.in);
		N = scan.nextInt();

		for(int i = 0; i < N; i++) {
			cards.add(scan.nextInt());
		}

		Collections.sort(cards, Collections.reverseOrder());

		for(int i = 0; i < N; i+=2) {
			Alice += cards.get(i);
		}
		for(int i = 1; i < N; i+=2) {
			Bob += cards.get(i);
		}
		System.out.println(Alice - Bob);
		scan.close();
	} int Alice = 0; Alice 0 int Bob = 0; Bob 0 int N; N ArrayList<Integer> cards = new ArrayList<Integer>(); cards new ArrayList<Integer>() Scanner scan = new Scanner(System.in); scan new Scanner(System.in) N = scan.nextInt() N scan.nextInt() scan.nextInt scan for(int i = 0; i < N; i++) {
			cards.add(scan.nextInt());
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			cards.add(scan.nextInt());
		} {
			cards.add(scan.nextInt());
		} cards.add(scan.nextInt()) cards.add cards scan.nextInt() scan.nextInt scan Collections.sort(cards, Collections.reverseOrder()) Collections.sort Collections cards Collections.reverseOrder() Collections.reverseOrder Collections for(int i = 0; i < N; i+=2) {
			Alice += cards.get(i);
		} int i = 0; int i = 0; i 0 i < N i N i+=2 i+=2 i 2 {
			Alice += cards.get(i);
		} {
			Alice += cards.get(i);
		} Alice += cards.get(i) Alice cards.get(i) cards.get cards i for(int i = 1; i < N; i+=2) {
			Bob += cards.get(i);
		} int i = 1; int i = 1; i 1 i < N i N i+=2 i+=2 i 2 {
			Bob += cards.get(i);
		} {
			Bob += cards.get(i);
		} Bob += cards.get(i) Bob cards.get(i) cards.get cards i System.out.println(Alice - Bob) System.out.println System.out System System.out Alice - Bob Alice Bob scan.close() scan.close scan String[] args args public class Main {
	public static void main(String[] args) {
		int Alice = 0;
		int Bob = 0;
		int N;
		ArrayList<Integer> cards = new ArrayList<Integer>();

		Scanner scan = new Scanner(System.in);
		N = scan.nextInt();

		for(int i = 0; i < N; i++) {
			cards.add(scan.nextInt());
		}

		Collections.sort(cards, Collections.reverseOrder());

		for(int i = 0; i < N; i+=2) {
			Alice += cards.get(i);
		}
		for(int i = 1; i < N; i+=2) {
			Bob += cards.get(i);
		}
		System.out.println(Alice - Bob);
		scan.close();
	}
} public class Main {
	public static void main(String[] args) {
		int Alice = 0;
		int Bob = 0;
		int N;
		ArrayList<Integer> cards = new ArrayList<Integer>();

		Scanner scan = new Scanner(System.in);
		N = scan.nextInt();

		for(int i = 0; i < N; i++) {
			cards.add(scan.nextInt());
		}

		Collections.sort(cards, Collections.reverseOrder());

		for(int i = 0; i < N; i+=2) {
			Alice += cards.get(i);
		}
		for(int i = 1; i < N; i+=2) {
			Bob += cards.get(i);
		}
		System.out.println(Alice - Bob);
		scan.close();
	}
} Main
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		int Alice = 0;
		int Bob = 0;
		int N;
		ArrayList<Integer> cards = new ArrayList<Integer>();

		Scanner scan = new Scanner(System.in);
		N = scan.nextInt();

		for(int i = 0; i < N; i++) {
			cards.add(scan.nextInt());
		}

		Collections.sort(cards, Collections.reverseOrder());

		for(int i = 0; i < N; i+=2) {
			Alice += cards.get(i);
		}
		for(int i = 1; i < N; i+=2) {
			Bob += cards.get(i);
		}
		System.out.println(Alice - Bob);
		scan.close();
	}
}