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) {
		Scanner scan = new Scanner(System.in);
		List<Integer> list = new ArrayList<>();
		int num = scan.nextInt();

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

		int sumAlice = 0;
		int sumBob   = 0;

		// カードを降順に並べ替え
		Collections.sort(list, Comparator.reverseOrder());


		// カードを交互に配る
		for(int i = 0; i < list.size(); i++) {
			if(i % 2 == 0)
				sumAlice += list.get(i);
			else
				sumBob   += list.get(i);
		}

		System.out.println(sumAlice - sumBob);
		scan.close();

	}

} 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) {
		Scanner scan = new Scanner(System.in);
		List<Integer> list = new ArrayList<>();
		int num = scan.nextInt();

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

		int sumAlice = 0;
		int sumBob   = 0;

		// カードを降順に並べ替え
		Collections.sort(list, Comparator.reverseOrder());


		// カードを交互に配る
		for(int i = 0; i < list.size(); i++) {
			if(i % 2 == 0)
				sumAlice += list.get(i);
			else
				sumBob   += list.get(i);
		}

		System.out.println(sumAlice - sumBob);
		scan.close();

	}

} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		List<Integer> list = new ArrayList<>();
		int num = scan.nextInt();

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

		int sumAlice = 0;
		int sumBob   = 0;

		// カードを降順に並べ替え
		Collections.sort(list, Comparator.reverseOrder());


		// カードを交互に配る
		for(int i = 0; i < list.size(); i++) {
			if(i % 2 == 0)
				sumAlice += list.get(i);
			else
				sumBob   += list.get(i);
		}

		System.out.println(sumAlice - sumBob);
		scan.close();

	} main {
		Scanner scan = new Scanner(System.in);
		List<Integer> list = new ArrayList<>();
		int num = scan.nextInt();

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

		int sumAlice = 0;
		int sumBob   = 0;

		// カードを降順に並べ替え
		Collections.sort(list, Comparator.reverseOrder());


		// カードを交互に配る
		for(int i = 0; i < list.size(); i++) {
			if(i % 2 == 0)
				sumAlice += list.get(i);
			else
				sumBob   += list.get(i);
		}

		System.out.println(sumAlice - sumBob);
		scan.close();

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) List<Integer> list = new ArrayList<>(); list new ArrayList<>() int num = scan.nextInt(); num scan.nextInt() scan.nextInt scan for(int i = 0; i < num; i++) {
			list.add(scan.nextInt());
		} int i = 0; int i = 0; i 0 i < num i num i++ i++ i {
			list.add(scan.nextInt());
		} {
			list.add(scan.nextInt());
		} list.add(scan.nextInt()) list.add list scan.nextInt() scan.nextInt scan int sumAlice = 0; sumAlice 0 int sumBob   = 0; sumBob 0 Collections.sort(list, Comparator.reverseOrder()) Collections.sort Collections list Comparator.reverseOrder() Comparator.reverseOrder Comparator for(int i = 0; i < list.size(); i++) {
			if(i % 2 == 0)
				sumAlice += list.get(i);
			else
				sumBob   += list.get(i);
		} int i = 0; int i = 0; i 0 i < list.size() i list.size() list.size list i++ i++ i {
			if(i % 2 == 0)
				sumAlice += list.get(i);
			else
				sumBob   += list.get(i);
		} {
			if(i % 2 == 0)
				sumAlice += list.get(i);
			else
				sumBob   += list.get(i);
		} if(i % 2 == 0)
				sumAlice += list.get(i);
			else
				sumBob   += list.get(i); i % 2 == 0 i % 2 i 2 0 sumAlice += list.get(i) sumAlice list.get(i) list.get list i sumBob   += list.get(i) sumBob list.get(i) list.get list i System.out.println(sumAlice - sumBob) System.out.println System.out System System.out sumAlice - sumBob sumAlice sumBob scan.close() scan.close scan String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		List<Integer> list = new ArrayList<>();
		int num = scan.nextInt();

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

		int sumAlice = 0;
		int sumBob   = 0;

		// カードを降順に並べ替え
		Collections.sort(list, Comparator.reverseOrder());


		// カードを交互に配る
		for(int i = 0; i < list.size(); i++) {
			if(i % 2 == 0)
				sumAlice += list.get(i);
			else
				sumBob   += list.get(i);
		}

		System.out.println(sumAlice - sumBob);
		scan.close();

	}

} public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		List<Integer> list = new ArrayList<>();
		int num = scan.nextInt();

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

		int sumAlice = 0;
		int sumBob   = 0;

		// カードを降順に並べ替え
		Collections.sort(list, Comparator.reverseOrder());


		// カードを交互に配る
		for(int i = 0; i < list.size(); i++) {
			if(i % 2 == 0)
				sumAlice += list.get(i);
			else
				sumBob   += list.get(i);
		}

		System.out.println(sumAlice - sumBob);
		scan.close();

	}

} 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) {
		Scanner scan = new Scanner(System.in);
		List<Integer> list = new ArrayList<>();
		int num = scan.nextInt();

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

		int sumAlice = 0;
		int sumBob   = 0;

		// カードを降順に並べ替え
		Collections.sort(list, Comparator.reverseOrder());


		// カードを交互に配る
		for(int i = 0; i < list.size(); i++) {
			if(i % 2 == 0)
				sumAlice += list.get(i);
			else
				sumBob   += list.get(i);
		}

		System.out.println(sumAlice - sumBob);
		scan.close();

	}

}