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

public class Main {
	public static void main(String[] args) {
//		  System.setIn(B081.class.getResourceAsStream("input.txt"));
		  Scanner in = new Scanner(System.in);

		  int n = in.nextInt();
		  int alice = 0;
		  int bob = 0;
		  Integer card[] = new Integer[n];

		  for(int i= 0; i < n; i++) {
			  card[i] = in.nextInt();
		  }

		  Arrays.sort(card,  Collections.reverseOrder());

		  for(int i = 0; i < n; i++) {
			  if(i == 0) {
				  alice += card[i];
				  continue;
			  }
			  if(i % 2 != 0) {
				  bob +=card[i];
				  continue;
			  }
			  alice += card[i];
		  }
		  System.out.println(alice - bob);
		  in.close();
	}
} import java.util.Arrays; Arrays 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) {
//		  System.setIn(B081.class.getResourceAsStream("input.txt"));
		  Scanner in = new Scanner(System.in);

		  int n = in.nextInt();
		  int alice = 0;
		  int bob = 0;
		  Integer card[] = new Integer[n];

		  for(int i= 0; i < n; i++) {
			  card[i] = in.nextInt();
		  }

		  Arrays.sort(card,  Collections.reverseOrder());

		  for(int i = 0; i < n; i++) {
			  if(i == 0) {
				  alice += card[i];
				  continue;
			  }
			  if(i % 2 != 0) {
				  bob +=card[i];
				  continue;
			  }
			  alice += card[i];
		  }
		  System.out.println(alice - bob);
		  in.close();
	}
} Main public static void main(String[] args) {
//		  System.setIn(B081.class.getResourceAsStream("input.txt"));
		  Scanner in = new Scanner(System.in);

		  int n = in.nextInt();
		  int alice = 0;
		  int bob = 0;
		  Integer card[] = new Integer[n];

		  for(int i= 0; i < n; i++) {
			  card[i] = in.nextInt();
		  }

		  Arrays.sort(card,  Collections.reverseOrder());

		  for(int i = 0; i < n; i++) {
			  if(i == 0) {
				  alice += card[i];
				  continue;
			  }
			  if(i % 2 != 0) {
				  bob +=card[i];
				  continue;
			  }
			  alice += card[i];
		  }
		  System.out.println(alice - bob);
		  in.close();
	} main {
//		  System.setIn(B081.class.getResourceAsStream("input.txt"));
		  Scanner in = new Scanner(System.in);

		  int n = in.nextInt();
		  int alice = 0;
		  int bob = 0;
		  Integer card[] = new Integer[n];

		  for(int i= 0; i < n; i++) {
			  card[i] = in.nextInt();
		  }

		  Arrays.sort(card,  Collections.reverseOrder());

		  for(int i = 0; i < n; i++) {
			  if(i == 0) {
				  alice += card[i];
				  continue;
			  }
			  if(i % 2 != 0) {
				  bob +=card[i];
				  continue;
			  }
			  alice += card[i];
		  }
		  System.out.println(alice - bob);
		  in.close();
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in int alice = 0; alice 0 int bob = 0; bob 0 Integer card[] = new Integer[n]; card new Integer[n] n for(int i= 0; i < n; i++) {
			  card[i] = in.nextInt();
		  } int i= 0; int i= 0; i 0 i < n i n i++ i++ i {
			  card[i] = in.nextInt();
		  } {
			  card[i] = in.nextInt();
		  } card[i] = in.nextInt() card[i] card i in.nextInt() in.nextInt in Arrays.sort(card,  Collections.reverseOrder()) Arrays.sort Arrays card Collections.reverseOrder() Collections.reverseOrder Collections for(int i = 0; i < n; i++) {
			  if(i == 0) {
				  alice += card[i];
				  continue;
			  }
			  if(i % 2 != 0) {
				  bob +=card[i];
				  continue;
			  }
			  alice += card[i];
		  } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			  if(i == 0) {
				  alice += card[i];
				  continue;
			  }
			  if(i % 2 != 0) {
				  bob +=card[i];
				  continue;
			  }
			  alice += card[i];
		  } {
			  if(i == 0) {
				  alice += card[i];
				  continue;
			  }
			  if(i % 2 != 0) {
				  bob +=card[i];
				  continue;
			  }
			  alice += card[i];
		  } if(i == 0) {
				  alice += card[i];
				  continue;
			  } i == 0 i 0 {
				  alice += card[i];
				  continue;
			  } alice += card[i] alice card[i] card i continue; if(i % 2 != 0) {
				  bob +=card[i];
				  continue;
			  } i % 2 != 0 i % 2 i 2 0 {
				  bob +=card[i];
				  continue;
			  } bob +=card[i] bob card[i] card i continue; alice += card[i] alice card[i] card i System.out.println(alice - bob) System.out.println System.out System System.out alice - bob alice bob in.close() in.close in String[] args args public class Main {
	public static void main(String[] args) {
//		  System.setIn(B081.class.getResourceAsStream("input.txt"));
		  Scanner in = new Scanner(System.in);

		  int n = in.nextInt();
		  int alice = 0;
		  int bob = 0;
		  Integer card[] = new Integer[n];

		  for(int i= 0; i < n; i++) {
			  card[i] = in.nextInt();
		  }

		  Arrays.sort(card,  Collections.reverseOrder());

		  for(int i = 0; i < n; i++) {
			  if(i == 0) {
				  alice += card[i];
				  continue;
			  }
			  if(i % 2 != 0) {
				  bob +=card[i];
				  continue;
			  }
			  alice += card[i];
		  }
		  System.out.println(alice - bob);
		  in.close();
	}
} public class Main {
	public static void main(String[] args) {
//		  System.setIn(B081.class.getResourceAsStream("input.txt"));
		  Scanner in = new Scanner(System.in);

		  int n = in.nextInt();
		  int alice = 0;
		  int bob = 0;
		  Integer card[] = new Integer[n];

		  for(int i= 0; i < n; i++) {
			  card[i] = in.nextInt();
		  }

		  Arrays.sort(card,  Collections.reverseOrder());

		  for(int i = 0; i < n; i++) {
			  if(i == 0) {
				  alice += card[i];
				  continue;
			  }
			  if(i % 2 != 0) {
				  bob +=card[i];
				  continue;
			  }
			  alice += card[i];
		  }
		  System.out.println(alice - bob);
		  in.close();
	}
} Main

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

public class Main {
	public static void main(String[] args) {
//		  System.setIn(B081.class.getResourceAsStream("input.txt"));
		  Scanner in = new Scanner(System.in);

		  int n = in.nextInt();
		  int alice = 0;
		  int bob = 0;
		  Integer card[] = new Integer[n];

		  for(int i= 0; i < n; i++) {
			  card[i] = in.nextInt();
		  }

		  Arrays.sort(card,  Collections.reverseOrder());

		  for(int i = 0; i < n; i++) {
			  if(i == 0) {
				  alice += card[i];
				  continue;
			  }
			  if(i % 2 != 0) {
				  bob +=card[i];
				  continue;
			  }
			  alice += card[i];
		  }
		  System.out.println(alice - bob);
		  in.close();
	}
}