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

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


		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		ArrayList<Integer> a =new ArrayList<>();

		//得点列aを生成
		for(int i=0; i < n; i++) {
			a.add(Integer.parseInt(sc.next()));
		}

		//降順にソート
		Collections.sort(a, Collections.reverseOrder());

		int alice = 0;
		int bob = 0;

		for(int i=0; i<n; i++) {
			if(i%2==0) {
				alice+=a.get(i);
			}else {
				bob+=a.get(i);
			}
		}

		int dif = alice - bob;

		System.out.println(dif);

	}
} 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[]) {


		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		ArrayList<Integer> a =new ArrayList<>();

		//得点列aを生成
		for(int i=0; i < n; i++) {
			a.add(Integer.parseInt(sc.next()));
		}

		//降順にソート
		Collections.sort(a, Collections.reverseOrder());

		int alice = 0;
		int bob = 0;

		for(int i=0; i<n; i++) {
			if(i%2==0) {
				alice+=a.get(i);
			}else {
				bob+=a.get(i);
			}
		}

		int dif = alice - bob;

		System.out.println(dif);

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


		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		ArrayList<Integer> a =new ArrayList<>();

		//得点列aを生成
		for(int i=0; i < n; i++) {
			a.add(Integer.parseInt(sc.next()));
		}

		//降順にソート
		Collections.sort(a, Collections.reverseOrder());

		int alice = 0;
		int bob = 0;

		for(int i=0; i<n; i++) {
			if(i%2==0) {
				alice+=a.get(i);
			}else {
				bob+=a.get(i);
			}
		}

		int dif = alice - bob;

		System.out.println(dif);

	} main {


		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		ArrayList<Integer> a =new ArrayList<>();

		//得点列aを生成
		for(int i=0; i < n; i++) {
			a.add(Integer.parseInt(sc.next()));
		}

		//降順にソート
		Collections.sort(a, Collections.reverseOrder());

		int alice = 0;
		int bob = 0;

		for(int i=0; i<n; i++) {
			if(i%2==0) {
				alice+=a.get(i);
			}else {
				bob+=a.get(i);
			}
		}

		int dif = alice - bob;

		System.out.println(dif);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc ArrayList<Integer> a =new ArrayList<>(); a new ArrayList<>() for(int i=0; i < n; i++) {
			a.add(Integer.parseInt(sc.next()));
		} int i=0; int i=0; i 0 i < n i n i++ i++ i {
			a.add(Integer.parseInt(sc.next()));
		} {
			a.add(Integer.parseInt(sc.next()));
		} a.add(Integer.parseInt(sc.next())) a.add a Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc Collections.sort(a, Collections.reverseOrder()) Collections.sort Collections a Collections.reverseOrder() Collections.reverseOrder Collections int alice = 0; alice 0 int bob = 0; bob 0 for(int i=0; i<n; i++) {
			if(i%2==0) {
				alice+=a.get(i);
			}else {
				bob+=a.get(i);
			}
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			if(i%2==0) {
				alice+=a.get(i);
			}else {
				bob+=a.get(i);
			}
		} {
			if(i%2==0) {
				alice+=a.get(i);
			}else {
				bob+=a.get(i);
			}
		} if(i%2==0) {
				alice+=a.get(i);
			}else {
				bob+=a.get(i);
			} i%2==0 i%2 i 2 0 {
				alice+=a.get(i);
			} alice+=a.get(i) alice a.get(i) a.get a i {
				bob+=a.get(i);
			} bob+=a.get(i) bob a.get(i) a.get a i int dif = alice - bob; dif alice - bob alice bob System.out.println(dif) System.out.println System.out System System.out dif String args[] args public class Main {
	public static void main(String args[]) {


		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		ArrayList<Integer> a =new ArrayList<>();

		//得点列aを生成
		for(int i=0; i < n; i++) {
			a.add(Integer.parseInt(sc.next()));
		}

		//降順にソート
		Collections.sort(a, Collections.reverseOrder());

		int alice = 0;
		int bob = 0;

		for(int i=0; i<n; i++) {
			if(i%2==0) {
				alice+=a.get(i);
			}else {
				bob+=a.get(i);
			}
		}

		int dif = alice - bob;

		System.out.println(dif);

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


		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		ArrayList<Integer> a =new ArrayList<>();

		//得点列aを生成
		for(int i=0; i < n; i++) {
			a.add(Integer.parseInt(sc.next()));
		}

		//降順にソート
		Collections.sort(a, Collections.reverseOrder());

		int alice = 0;
		int bob = 0;

		for(int i=0; i<n; i++) {
			if(i%2==0) {
				alice+=a.get(i);
			}else {
				bob+=a.get(i);
			}
		}

		int dif = alice - bob;

		System.out.println(dif);

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

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


		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		ArrayList<Integer> a =new ArrayList<>();

		//得点列aを生成
		for(int i=0; i < n; i++) {
			a.add(Integer.parseInt(sc.next()));
		}

		//降順にソート
		Collections.sort(a, Collections.reverseOrder());

		int alice = 0;
		int bob = 0;

		for(int i=0; i<n; i++) {
			if(i%2==0) {
				alice+=a.get(i);
			}else {
				bob+=a.get(i);
			}
		}

		int dif = alice - bob;

		System.out.println(dif);

	}
}
