import java.util.Collections;
import java.util.Scanner;
import java.util.Stack;

public class Main {

	public static void main(String[] args) {
		CardGameForTwo solver = new CardGameForTwo();
		solver.readInput();
		solver.solve();
		solver.writeOutput();
	}

	static class CardGameForTwo {

		private int n;
		private Stack a;
		private int output;

		private Scanner scanner;

		public CardGameForTwo() {
			scanner = new Scanner(System.in);
			a = new Stack();
			output = 0;
		}

		public void readInput() {
			n = scanner.nextInt();
			for(int i=0; i<n; i++) {
				a.push(scanner.nextInt());
			}
		}

		public  void solve() {
			Collections.sort(a);
			int alice = 0;
			int bob = 0;
			while(!a.isEmpty()) {
				alice += (int) a.pop();
				if(a.isEmpty()) {
					break;
				}
				bob += (int) a.pop();
			}
			output = alice - bob;
		}
		public void writeOutput() {
			System.out.println(output);
		}

	}

} import java.util.Collections; Collections java.util import java.util.Scanner; Scanner java.util import java.util.Stack; Stack java.util public class Main {

	public static void main(String[] args) {
		CardGameForTwo solver = new CardGameForTwo();
		solver.readInput();
		solver.solve();
		solver.writeOutput();
	}

	static class CardGameForTwo {

		private int n;
		private Stack a;
		private int output;

		private Scanner scanner;

		public CardGameForTwo() {
			scanner = new Scanner(System.in);
			a = new Stack();
			output = 0;
		}

		public void readInput() {
			n = scanner.nextInt();
			for(int i=0; i<n; i++) {
				a.push(scanner.nextInt());
			}
		}

		public  void solve() {
			Collections.sort(a);
			int alice = 0;
			int bob = 0;
			while(!a.isEmpty()) {
				alice += (int) a.pop();
				if(a.isEmpty()) {
					break;
				}
				bob += (int) a.pop();
			}
			output = alice - bob;
		}
		public void writeOutput() {
			System.out.println(output);
		}

	}

} Main public static void main(String[] args) {
		CardGameForTwo solver = new CardGameForTwo();
		solver.readInput();
		solver.solve();
		solver.writeOutput();
	} main {
		CardGameForTwo solver = new CardGameForTwo();
		solver.readInput();
		solver.solve();
		solver.writeOutput();
	} CardGameForTwo solver = new CardGameForTwo(); solver new CardGameForTwo() solver.readInput() solver.readInput solver solver.solve() solver.solve solver solver.writeOutput() solver.writeOutput solver String[] args args static class CardGameForTwo {

		private int n;
		private Stack a;
		private int output;

		private Scanner scanner;

		public CardGameForTwo() {
			scanner = new Scanner(System.in);
			a = new Stack();
			output = 0;
		}

		public void readInput() {
			n = scanner.nextInt();
			for(int i=0; i<n; i++) {
				a.push(scanner.nextInt());
			}
		}

		public  void solve() {
			Collections.sort(a);
			int alice = 0;
			int bob = 0;
			while(!a.isEmpty()) {
				alice += (int) a.pop();
				if(a.isEmpty()) {
					break;
				}
				bob += (int) a.pop();
			}
			output = alice - bob;
		}
		public void writeOutput() {
			System.out.println(output);
		}

	} CardGameForTwo private int n; n private Stack a; a private int output; output private Scanner scanner; scanner public CardGameForTwo() {
			scanner = new Scanner(System.in);
			a = new Stack();
			output = 0;
		} CardGameForTwo {
			scanner = new Scanner(System.in);
			a = new Stack();
			output = 0;
		} scanner = new Scanner(System.in) scanner new Scanner(System.in) a = new Stack() a new Stack() output = 0 output 0 public void readInput() {
			n = scanner.nextInt();
			for(int i=0; i<n; i++) {
				a.push(scanner.nextInt());
			}
		} readInput {
			n = scanner.nextInt();
			for(int i=0; i<n; i++) {
				a.push(scanner.nextInt());
			}
		} n = scanner.nextInt() n scanner.nextInt() scanner.nextInt scanner for(int i=0; i<n; i++) {
				a.push(scanner.nextInt());
			} int i=0; int i=0; i 0 i<n i n i++ i++ i {
				a.push(scanner.nextInt());
			} {
				a.push(scanner.nextInt());
			} a.push(scanner.nextInt()) a.push a scanner.nextInt() scanner.nextInt scanner public  void solve() {
			Collections.sort(a);
			int alice = 0;
			int bob = 0;
			while(!a.isEmpty()) {
				alice += (int) a.pop();
				if(a.isEmpty()) {
					break;
				}
				bob += (int) a.pop();
			}
			output = alice - bob;
		} solve {
			Collections.sort(a);
			int alice = 0;
			int bob = 0;
			while(!a.isEmpty()) {
				alice += (int) a.pop();
				if(a.isEmpty()) {
					break;
				}
				bob += (int) a.pop();
			}
			output = alice - bob;
		} Collections.sort(a) Collections.sort Collections a int alice = 0; alice 0 int bob = 0; bob 0 while(!a.isEmpty()) {
				alice += (int) a.pop();
				if(a.isEmpty()) {
					break;
				}
				bob += (int) a.pop();
			} !a.isEmpty() a.isEmpty() a.isEmpty a {
				alice += (int) a.pop();
				if(a.isEmpty()) {
					break;
				}
				bob += (int) a.pop();
			} alice += (int) a.pop() alice (int) a.pop() a.pop a if(a.isEmpty()) {
					break;
				} a.isEmpty() a.isEmpty a {
					break;
				} break; bob += (int) a.pop() bob (int) a.pop() a.pop a output = alice - bob output alice - bob alice bob public void writeOutput() {
			System.out.println(output);
		} writeOutput {
			System.out.println(output);
		} System.out.println(output) System.out.println System.out System System.out output public class Main {

	public static void main(String[] args) {
		CardGameForTwo solver = new CardGameForTwo();
		solver.readInput();
		solver.solve();
		solver.writeOutput();
	}

	static class CardGameForTwo {

		private int n;
		private Stack a;
		private int output;

		private Scanner scanner;

		public CardGameForTwo() {
			scanner = new Scanner(System.in);
			a = new Stack();
			output = 0;
		}

		public void readInput() {
			n = scanner.nextInt();
			for(int i=0; i<n; i++) {
				a.push(scanner.nextInt());
			}
		}

		public  void solve() {
			Collections.sort(a);
			int alice = 0;
			int bob = 0;
			while(!a.isEmpty()) {
				alice += (int) a.pop();
				if(a.isEmpty()) {
					break;
				}
				bob += (int) a.pop();
			}
			output = alice - bob;
		}
		public void writeOutput() {
			System.out.println(output);
		}

	}

} public class Main {

	public static void main(String[] args) {
		CardGameForTwo solver = new CardGameForTwo();
		solver.readInput();
		solver.solve();
		solver.writeOutput();
	}

	static class CardGameForTwo {

		private int n;
		private Stack a;
		private int output;

		private Scanner scanner;

		public CardGameForTwo() {
			scanner = new Scanner(System.in);
			a = new Stack();
			output = 0;
		}

		public void readInput() {
			n = scanner.nextInt();
			for(int i=0; i<n; i++) {
				a.push(scanner.nextInt());
			}
		}

		public  void solve() {
			Collections.sort(a);
			int alice = 0;
			int bob = 0;
			while(!a.isEmpty()) {
				alice += (int) a.pop();
				if(a.isEmpty()) {
					break;
				}
				bob += (int) a.pop();
			}
			output = alice - bob;
		}
		public void writeOutput() {
			System.out.println(output);
		}

	}

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

public class Main {

	public static void main(String[] args) {
		CardGameForTwo solver = new CardGameForTwo();
		solver.readInput();
		solver.solve();
		solver.writeOutput();
	}

	static class CardGameForTwo {

		private int n;
		private Stack a;
		private int output;

		private Scanner scanner;

		public CardGameForTwo() {
			scanner = new Scanner(System.in);
			a = new Stack();
			output = 0;
		}

		public void readInput() {
			n = scanner.nextInt();
			for(int i=0; i<n; i++) {
				a.push(scanner.nextInt());
			}
		}

		public  void solve() {
			Collections.sort(a);
			int alice = 0;
			int bob = 0;
			while(!a.isEmpty()) {
				alice += (int) a.pop();
				if(a.isEmpty()) {
					break;
				}
				bob += (int) a.pop();
			}
			output = alice - bob;
		}
		public void writeOutput() {
			System.out.println(output);
		}

	}

}
