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> list = new ArrayList<>();
		for(int i = 0; i < N; i++) {
			list.add(Integer.parseInt(sc.next()));
		}
		sc.close();
		Collections.sort(list, Collections.reverseOrder());
		int count = 0;
		int alice = 0;
		int bob = 0;
		for(int i = 0; i < list.size(); i++) {
			if(count % 2 == 0) {
				alice += list.get(i);
			}else {
				bob += list.get(i);
			}
			count++;
		}
		int ans = alice - bob;
		System.out.println(ans);
	}
} 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> list = new ArrayList<>();
		for(int i = 0; i < N; i++) {
			list.add(Integer.parseInt(sc.next()));
		}
		sc.close();
		Collections.sort(list, Collections.reverseOrder());
		int count = 0;
		int alice = 0;
		int bob = 0;
		for(int i = 0; i < list.size(); i++) {
			if(count % 2 == 0) {
				alice += list.get(i);
			}else {
				bob += list.get(i);
			}
			count++;
		}
		int ans = alice - bob;
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		ArrayList<Integer> list = new ArrayList<>();
		for(int i = 0; i < N; i++) {
			list.add(Integer.parseInt(sc.next()));
		}
		sc.close();
		Collections.sort(list, Collections.reverseOrder());
		int count = 0;
		int alice = 0;
		int bob = 0;
		for(int i = 0; i < list.size(); i++) {
			if(count % 2 == 0) {
				alice += list.get(i);
			}else {
				bob += list.get(i);
			}
			count++;
		}
		int ans = alice - bob;
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		ArrayList<Integer> list = new ArrayList<>();
		for(int i = 0; i < N; i++) {
			list.add(Integer.parseInt(sc.next()));
		}
		sc.close();
		Collections.sort(list, Collections.reverseOrder());
		int count = 0;
		int alice = 0;
		int bob = 0;
		for(int i = 0; i < list.size(); i++) {
			if(count % 2 == 0) {
				alice += list.get(i);
			}else {
				bob += list.get(i);
			}
			count++;
		}
		int ans = alice - bob;
		System.out.println(ans);
	} 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> list = new ArrayList<>(); list new ArrayList<>() for(int i = 0; i < N; i++) {
			list.add(Integer.parseInt(sc.next()));
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			list.add(Integer.parseInt(sc.next()));
		} {
			list.add(Integer.parseInt(sc.next()));
		} list.add(Integer.parseInt(sc.next())) list.add list Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc sc.close() sc.close sc Collections.sort(list, Collections.reverseOrder()) Collections.sort Collections list Collections.reverseOrder() Collections.reverseOrder Collections int count = 0; count 0 int alice = 0; alice 0 int bob = 0; bob 0 for(int i = 0; i < list.size(); i++) {
			if(count % 2 == 0) {
				alice += list.get(i);
			}else {
				bob += list.get(i);
			}
			count++;
		} int i = 0; int i = 0; i 0 i < list.size() i list.size() list.size list i++ i++ i {
			if(count % 2 == 0) {
				alice += list.get(i);
			}else {
				bob += list.get(i);
			}
			count++;
		} {
			if(count % 2 == 0) {
				alice += list.get(i);
			}else {
				bob += list.get(i);
			}
			count++;
		} if(count % 2 == 0) {
				alice += list.get(i);
			}else {
				bob += list.get(i);
			} count % 2 == 0 count % 2 count 2 0 {
				alice += list.get(i);
			} alice += list.get(i) alice list.get(i) list.get list i {
				bob += list.get(i);
			} bob += list.get(i) bob list.get(i) list.get list i count++ count int ans = alice - bob; ans alice - bob alice bob System.out.println(ans) System.out.println System.out System System.out ans 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> list = new ArrayList<>();
		for(int i = 0; i < N; i++) {
			list.add(Integer.parseInt(sc.next()));
		}
		sc.close();
		Collections.sort(list, Collections.reverseOrder());
		int count = 0;
		int alice = 0;
		int bob = 0;
		for(int i = 0; i < list.size(); i++) {
			if(count % 2 == 0) {
				alice += list.get(i);
			}else {
				bob += list.get(i);
			}
			count++;
		}
		int ans = alice - bob;
		System.out.println(ans);
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		ArrayList<Integer> list = new ArrayList<>();
		for(int i = 0; i < N; i++) {
			list.add(Integer.parseInt(sc.next()));
		}
		sc.close();
		Collections.sort(list, Collections.reverseOrder());
		int count = 0;
		int alice = 0;
		int bob = 0;
		for(int i = 0; i < list.size(); i++) {
			if(count % 2 == 0) {
				alice += list.get(i);
			}else {
				bob += list.get(i);
			}
			count++;
		}
		int ans = alice - bob;
		System.out.println(ans);
	}
} 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> list = new ArrayList<>();
		for(int i = 0; i < N; i++) {
			list.add(Integer.parseInt(sc.next()));
		}
		sc.close();
		Collections.sort(list, Collections.reverseOrder());
		int count = 0;
		int alice = 0;
		int bob = 0;
		for(int i = 0; i < list.size(); i++) {
			if(count % 2 == 0) {
				alice += list.get(i);
			}else {
				bob += list.get(i);
			}
			count++;
		}
		int ans = alice - bob;
		System.out.println(ans);
	}
}