import java.util.Arrays;
import java.util.Scanner;

public class Main{
	  public static void main(String[] args){
		  Scanner sc = new Scanner(System.in);
		  int N = sc.nextInt();
		  int[] lst = new int[N];
		  int alice_point = 0;
		  int bob_point = 0;

		  for(int i = 0; i < N; i++) {
			  lst[i] = sc.nextInt();
		  }

		  lst = sortDesc(lst);

		  for(int i = 0; i < N; i++) {
			  if(i % 2 == 0) {
				  alice_point += lst[i];
			  } else {
				  bob_point += lst[i];
			  }
		  }
		  System.out.println(alice_point - bob_point);
	  }

	  static int[] sortDesc(int[] lst) {
		  Arrays.sort(lst);

		  int[] lst_temp = new int[lst.length];

		  for(int i = 0; i < lst.length; i++) {
			  lst_temp[i] = lst[lst.length - 1 - i];
		  }

		  for(int i = 0; i < lst.length; i++) {
			  lst[i] = lst_temp[i];
		  }
		  return lst;
	  }
} import java.util.Arrays; Arrays 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 = sc.nextInt();
		  int[] lst = new int[N];
		  int alice_point = 0;
		  int bob_point = 0;

		  for(int i = 0; i < N; i++) {
			  lst[i] = sc.nextInt();
		  }

		  lst = sortDesc(lst);

		  for(int i = 0; i < N; i++) {
			  if(i % 2 == 0) {
				  alice_point += lst[i];
			  } else {
				  bob_point += lst[i];
			  }
		  }
		  System.out.println(alice_point - bob_point);
	  }

	  static int[] sortDesc(int[] lst) {
		  Arrays.sort(lst);

		  int[] lst_temp = new int[lst.length];

		  for(int i = 0; i < lst.length; i++) {
			  lst_temp[i] = lst[lst.length - 1 - i];
		  }

		  for(int i = 0; i < lst.length; i++) {
			  lst[i] = lst_temp[i];
		  }
		  return lst;
	  }
} Main public static void main(String[] args){
		  Scanner sc = new Scanner(System.in);
		  int N = sc.nextInt();
		  int[] lst = new int[N];
		  int alice_point = 0;
		  int bob_point = 0;

		  for(int i = 0; i < N; i++) {
			  lst[i] = sc.nextInt();
		  }

		  lst = sortDesc(lst);

		  for(int i = 0; i < N; i++) {
			  if(i % 2 == 0) {
				  alice_point += lst[i];
			  } else {
				  bob_point += lst[i];
			  }
		  }
		  System.out.println(alice_point - bob_point);
	  } main {
		  Scanner sc = new Scanner(System.in);
		  int N = sc.nextInt();
		  int[] lst = new int[N];
		  int alice_point = 0;
		  int bob_point = 0;

		  for(int i = 0; i < N; i++) {
			  lst[i] = sc.nextInt();
		  }

		  lst = sortDesc(lst);

		  for(int i = 0; i < N; i++) {
			  if(i % 2 == 0) {
				  alice_point += lst[i];
			  } else {
				  bob_point += lst[i];
			  }
		  }
		  System.out.println(alice_point - bob_point);
	  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] lst = new int[N]; lst new int[N] N int alice_point = 0; alice_point 0 int bob_point = 0; bob_point 0 for(int i = 0; i < N; i++) {
			  lst[i] = sc.nextInt();
		  } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			  lst[i] = sc.nextInt();
		  } {
			  lst[i] = sc.nextInt();
		  } lst[i] = sc.nextInt() lst[i] lst i sc.nextInt() sc.nextInt sc lst = sortDesc(lst) lst sortDesc(lst) sortDesc lst for(int i = 0; i < N; i++) {
			  if(i % 2 == 0) {
				  alice_point += lst[i];
			  } else {
				  bob_point += lst[i];
			  }
		  } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			  if(i % 2 == 0) {
				  alice_point += lst[i];
			  } else {
				  bob_point += lst[i];
			  }
		  } {
			  if(i % 2 == 0) {
				  alice_point += lst[i];
			  } else {
				  bob_point += lst[i];
			  }
		  } if(i % 2 == 0) {
				  alice_point += lst[i];
			  } else {
				  bob_point += lst[i];
			  } i % 2 == 0 i % 2 i 2 0 {
				  alice_point += lst[i];
			  } alice_point += lst[i] alice_point lst[i] lst i {
				  bob_point += lst[i];
			  } bob_point += lst[i] bob_point lst[i] lst i System.out.println(alice_point - bob_point) System.out.println System.out System System.out alice_point - bob_point alice_point bob_point String[] args args static int[] sortDesc(int[] lst) {
		  Arrays.sort(lst);

		  int[] lst_temp = new int[lst.length];

		  for(int i = 0; i < lst.length; i++) {
			  lst_temp[i] = lst[lst.length - 1 - i];
		  }

		  for(int i = 0; i < lst.length; i++) {
			  lst[i] = lst_temp[i];
		  }
		  return lst;
	  } sortDesc {
		  Arrays.sort(lst);

		  int[] lst_temp = new int[lst.length];

		  for(int i = 0; i < lst.length; i++) {
			  lst_temp[i] = lst[lst.length - 1 - i];
		  }

		  for(int i = 0; i < lst.length; i++) {
			  lst[i] = lst_temp[i];
		  }
		  return lst;
	  } Arrays.sort(lst) Arrays.sort Arrays lst int[] lst_temp = new int[lst.length]; lst_temp new int[lst.length] lst.length lst lst.length for(int i = 0; i < lst.length; i++) {
			  lst_temp[i] = lst[lst.length - 1 - i];
		  } int i = 0; int i = 0; i 0 i < lst.length i lst.length lst lst.length i++ i++ i {
			  lst_temp[i] = lst[lst.length - 1 - i];
		  } {
			  lst_temp[i] = lst[lst.length - 1 - i];
		  } lst_temp[i] = lst[lst.length - 1 - i] lst_temp[i] lst_temp i lst[lst.length - 1 - i] lst lst.length - 1 - i lst.length - 1 - i lst.length lst lst.length 1 i for(int i = 0; i < lst.length; i++) {
			  lst[i] = lst_temp[i];
		  } int i = 0; int i = 0; i 0 i < lst.length i lst.length lst lst.length i++ i++ i {
			  lst[i] = lst_temp[i];
		  } {
			  lst[i] = lst_temp[i];
		  } lst[i] = lst_temp[i] lst[i] lst i lst_temp[i] lst_temp i return lst; lst int[] lst lst public class Main{
	  public static void main(String[] args){
		  Scanner sc = new Scanner(System.in);
		  int N = sc.nextInt();
		  int[] lst = new int[N];
		  int alice_point = 0;
		  int bob_point = 0;

		  for(int i = 0; i < N; i++) {
			  lst[i] = sc.nextInt();
		  }

		  lst = sortDesc(lst);

		  for(int i = 0; i < N; i++) {
			  if(i % 2 == 0) {
				  alice_point += lst[i];
			  } else {
				  bob_point += lst[i];
			  }
		  }
		  System.out.println(alice_point - bob_point);
	  }

	  static int[] sortDesc(int[] lst) {
		  Arrays.sort(lst);

		  int[] lst_temp = new int[lst.length];

		  for(int i = 0; i < lst.length; i++) {
			  lst_temp[i] = lst[lst.length - 1 - i];
		  }

		  for(int i = 0; i < lst.length; i++) {
			  lst[i] = lst_temp[i];
		  }
		  return lst;
	  }
} public class Main{
	  public static void main(String[] args){
		  Scanner sc = new Scanner(System.in);
		  int N = sc.nextInt();
		  int[] lst = new int[N];
		  int alice_point = 0;
		  int bob_point = 0;

		  for(int i = 0; i < N; i++) {
			  lst[i] = sc.nextInt();
		  }

		  lst = sortDesc(lst);

		  for(int i = 0; i < N; i++) {
			  if(i % 2 == 0) {
				  alice_point += lst[i];
			  } else {
				  bob_point += lst[i];
			  }
		  }
		  System.out.println(alice_point - bob_point);
	  }

	  static int[] sortDesc(int[] lst) {
		  Arrays.sort(lst);

		  int[] lst_temp = new int[lst.length];

		  for(int i = 0; i < lst.length; i++) {
			  lst_temp[i] = lst[lst.length - 1 - i];
		  }

		  for(int i = 0; i < lst.length; i++) {
			  lst[i] = lst_temp[i];
		  }
		  return lst;
	  }
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main{
	  public static void main(String[] args){
		  Scanner sc = new Scanner(System.in);
		  int N = sc.nextInt();
		  int[] lst = new int[N];
		  int alice_point = 0;
		  int bob_point = 0;

		  for(int i = 0; i < N; i++) {
			  lst[i] = sc.nextInt();
		  }

		  lst = sortDesc(lst);

		  for(int i = 0; i < N; i++) {
			  if(i % 2 == 0) {
				  alice_point += lst[i];
			  } else {
				  bob_point += lst[i];
			  }
		  }
		  System.out.println(alice_point - bob_point);
	  }

	  static int[] sortDesc(int[] lst) {
		  Arrays.sort(lst);

		  int[] lst_temp = new int[lst.length];

		  for(int i = 0; i < lst.length; i++) {
			  lst_temp[i] = lst[lst.length - 1 - i];
		  }

		  for(int i = 0; i < lst.length; i++) {
			  lst[i] = lst_temp[i];
		  }
		  return lst;
	  }
}