import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		List<Integer> cards = new ArrayList<Integer>();
		for(int i = 0; i < n; ++i) {
			int card = scan.nextInt();
			cards.add(card);
		}
		scan.close();

		int aliceSum = 0;
		int bobSum = 0;
		boolean aliceTurn = true;

		for(int i=0; i<cards.size(); ++i) {
			if(aliceTurn) {
				aliceSum += getMax(cards);
			} else {
				bobSum += getMax(cards);
			}
			aliceTurn = !aliceTurn;
		}
		System.out.println(aliceSum - bobSum);

	}

	public static int getMax(List<Integer> cards) {
		int max = -1;
		int id = -1;
		for(int i=0; i<cards.size(); ++i) {
			if(cards.get(i) > max) {
				max = cards.get(i);
				id = i;
			}
		}
		cards.set(id,0);
		return max;
	}
} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		List<Integer> cards = new ArrayList<Integer>();
		for(int i = 0; i < n; ++i) {
			int card = scan.nextInt();
			cards.add(card);
		}
		scan.close();

		int aliceSum = 0;
		int bobSum = 0;
		boolean aliceTurn = true;

		for(int i=0; i<cards.size(); ++i) {
			if(aliceTurn) {
				aliceSum += getMax(cards);
			} else {
				bobSum += getMax(cards);
			}
			aliceTurn = !aliceTurn;
		}
		System.out.println(aliceSum - bobSum);

	}

	public static int getMax(List<Integer> cards) {
		int max = -1;
		int id = -1;
		for(int i=0; i<cards.size(); ++i) {
			if(cards.get(i) > max) {
				max = cards.get(i);
				id = i;
			}
		}
		cards.set(id,0);
		return max;
	}
} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		List<Integer> cards = new ArrayList<Integer>();
		for(int i = 0; i < n; ++i) {
			int card = scan.nextInt();
			cards.add(card);
		}
		scan.close();

		int aliceSum = 0;
		int bobSum = 0;
		boolean aliceTurn = true;

		for(int i=0; i<cards.size(); ++i) {
			if(aliceTurn) {
				aliceSum += getMax(cards);
			} else {
				bobSum += getMax(cards);
			}
			aliceTurn = !aliceTurn;
		}
		System.out.println(aliceSum - bobSum);

	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		List<Integer> cards = new ArrayList<Integer>();
		for(int i = 0; i < n; ++i) {
			int card = scan.nextInt();
			cards.add(card);
		}
		scan.close();

		int aliceSum = 0;
		int bobSum = 0;
		boolean aliceTurn = true;

		for(int i=0; i<cards.size(); ++i) {
			if(aliceTurn) {
				aliceSum += getMax(cards);
			} else {
				bobSum += getMax(cards);
			}
			aliceTurn = !aliceTurn;
		}
		System.out.println(aliceSum - bobSum);

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan List<Integer> cards = new ArrayList<Integer>(); cards new ArrayList<Integer>() for(int i = 0; i < n; ++i) {
			int card = scan.nextInt();
			cards.add(card);
		} int i = 0; int i = 0; i 0 i < n i n ++i ++i i {
			int card = scan.nextInt();
			cards.add(card);
		} {
			int card = scan.nextInt();
			cards.add(card);
		} int card = scan.nextInt(); card scan.nextInt() scan.nextInt scan cards.add(card) cards.add cards card scan.close() scan.close scan int aliceSum = 0; aliceSum 0 int bobSum = 0; bobSum 0 boolean aliceTurn = true; aliceTurn true for(int i=0; i<cards.size(); ++i) {
			if(aliceTurn) {
				aliceSum += getMax(cards);
			} else {
				bobSum += getMax(cards);
			}
			aliceTurn = !aliceTurn;
		} int i=0; int i=0; i 0 i<cards.size() i cards.size() cards.size cards ++i ++i i {
			if(aliceTurn) {
				aliceSum += getMax(cards);
			} else {
				bobSum += getMax(cards);
			}
			aliceTurn = !aliceTurn;
		} {
			if(aliceTurn) {
				aliceSum += getMax(cards);
			} else {
				bobSum += getMax(cards);
			}
			aliceTurn = !aliceTurn;
		} if(aliceTurn) {
				aliceSum += getMax(cards);
			} else {
				bobSum += getMax(cards);
			} aliceTurn {
				aliceSum += getMax(cards);
			} aliceSum += getMax(cards) aliceSum getMax(cards) getMax cards {
				bobSum += getMax(cards);
			} bobSum += getMax(cards) bobSum getMax(cards) getMax cards aliceTurn = !aliceTurn aliceTurn !aliceTurn aliceTurn System.out.println(aliceSum - bobSum) System.out.println System.out System System.out aliceSum - bobSum aliceSum bobSum String[] args args public static int getMax(List<Integer> cards) {
		int max = -1;
		int id = -1;
		for(int i=0; i<cards.size(); ++i) {
			if(cards.get(i) > max) {
				max = cards.get(i);
				id = i;
			}
		}
		cards.set(id,0);
		return max;
	} getMax {
		int max = -1;
		int id = -1;
		for(int i=0; i<cards.size(); ++i) {
			if(cards.get(i) > max) {
				max = cards.get(i);
				id = i;
			}
		}
		cards.set(id,0);
		return max;
	} int max = -1; max -1 1 int id = -1; id -1 1 for(int i=0; i<cards.size(); ++i) {
			if(cards.get(i) > max) {
				max = cards.get(i);
				id = i;
			}
		} int i=0; int i=0; i 0 i<cards.size() i cards.size() cards.size cards ++i ++i i {
			if(cards.get(i) > max) {
				max = cards.get(i);
				id = i;
			}
		} {
			if(cards.get(i) > max) {
				max = cards.get(i);
				id = i;
			}
		} if(cards.get(i) > max) {
				max = cards.get(i);
				id = i;
			} cards.get(i) > max cards.get(i) cards.get cards i max {
				max = cards.get(i);
				id = i;
			} max = cards.get(i) max cards.get(i) cards.get cards i id = i id i cards.set(id,0) cards.set cards id 0 return max; max List<Integer> cards cards public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		List<Integer> cards = new ArrayList<Integer>();
		for(int i = 0; i < n; ++i) {
			int card = scan.nextInt();
			cards.add(card);
		}
		scan.close();

		int aliceSum = 0;
		int bobSum = 0;
		boolean aliceTurn = true;

		for(int i=0; i<cards.size(); ++i) {
			if(aliceTurn) {
				aliceSum += getMax(cards);
			} else {
				bobSum += getMax(cards);
			}
			aliceTurn = !aliceTurn;
		}
		System.out.println(aliceSum - bobSum);

	}

	public static int getMax(List<Integer> cards) {
		int max = -1;
		int id = -1;
		for(int i=0; i<cards.size(); ++i) {
			if(cards.get(i) > max) {
				max = cards.get(i);
				id = i;
			}
		}
		cards.set(id,0);
		return max;
	}
} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		List<Integer> cards = new ArrayList<Integer>();
		for(int i = 0; i < n; ++i) {
			int card = scan.nextInt();
			cards.add(card);
		}
		scan.close();

		int aliceSum = 0;
		int bobSum = 0;
		boolean aliceTurn = true;

		for(int i=0; i<cards.size(); ++i) {
			if(aliceTurn) {
				aliceSum += getMax(cards);
			} else {
				bobSum += getMax(cards);
			}
			aliceTurn = !aliceTurn;
		}
		System.out.println(aliceSum - bobSum);

	}

	public static int getMax(List<Integer> cards) {
		int max = -1;
		int id = -1;
		for(int i=0; i<cards.size(); ++i) {
			if(cards.get(i) > max) {
				max = cards.get(i);
				id = i;
			}
		}
		cards.set(id,0);
		return max;
	}
} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		List<Integer> cards = new ArrayList<Integer>();
		for(int i = 0; i < n; ++i) {
			int card = scan.nextInt();
			cards.add(card);
		}
		scan.close();

		int aliceSum = 0;
		int bobSum = 0;
		boolean aliceTurn = true;

		for(int i=0; i<cards.size(); ++i) {
			if(aliceTurn) {
				aliceSum += getMax(cards);
			} else {
				bobSum += getMax(cards);
			}
			aliceTurn = !aliceTurn;
		}
		System.out.println(aliceSum - bobSum);

	}

	public static int getMax(List<Integer> cards) {
		int max = -1;
		int id = -1;
		for(int i=0; i<cards.size(); ++i) {
			if(cards.get(i) > max) {
				max = cards.get(i);
				id = i;
			}
		}
		cards.set(id,0);
		return max;
	}
}