import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try(Scanner scan = new Scanner(System.in)){
			int N = Integer.parseInt(scan.next());//標準入力の数
			List<Integer> list = new ArrayList<Integer>();//標準入力格納リスト
			for(int i=0; i<N; i++) {//入力内容をリストに格納
				list.add(Integer.parseInt(scan.next()));
			}
			int turn = 1; // 1:Alice , -1:Bob
			List<Integer> aliceCard = new ArrayList<Integer>();//Alice's Card
			List<Integer> bobCard = new ArrayList<Integer>();// Bob's Card
			
			while(list.size() > 0) {
				int currentMax = getMax(list);
				if(turn == 1) {
					aliceCard.add(currentMax);
				}else{
					bobCard.add(currentMax);
				}
              	turn = turn * -1;
				deleteMax(list, currentMax);
			}
			int aliceSum = getSum(aliceCard);
			int bobSum = getSum(bobCard);
			System.out.println(aliceSum - bobSum);
			
			
		}
	}
	public static int getMax(List<Integer> list) {
		int max = 0;
		for(int num: list) {
			if(num > max) {
				max = num;
			}
		}
		return max;
	}
	 public static void deleteMax(List<Integer> list, int max) {
		 Iterator<Integer> ite = list.iterator();
		 while(ite.hasNext()) {
			 int elm = ite.next();
			 if(elm == max) {
				 ite.remove();
               	 break;
			 }
		 }
	 }
	 public static int getSum(List<Integer> list) {
		 int sum = 0;
		 for(int elm: list) {
			 sum = sum + elm;
		 }
		 return sum;
	 }

} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try(Scanner scan = new Scanner(System.in)){
			int N = Integer.parseInt(scan.next());//標準入力の数
			List<Integer> list = new ArrayList<Integer>();//標準入力格納リスト
			for(int i=0; i<N; i++) {//入力内容をリストに格納
				list.add(Integer.parseInt(scan.next()));
			}
			int turn = 1; // 1:Alice , -1:Bob
			List<Integer> aliceCard = new ArrayList<Integer>();//Alice's Card
			List<Integer> bobCard = new ArrayList<Integer>();// Bob's Card
			
			while(list.size() > 0) {
				int currentMax = getMax(list);
				if(turn == 1) {
					aliceCard.add(currentMax);
				}else{
					bobCard.add(currentMax);
				}
              	turn = turn * -1;
				deleteMax(list, currentMax);
			}
			int aliceSum = getSum(aliceCard);
			int bobSum = getSum(bobCard);
			System.out.println(aliceSum - bobSum);
			
			
		}
	}
	public static int getMax(List<Integer> list) {
		int max = 0;
		for(int num: list) {
			if(num > max) {
				max = num;
			}
		}
		return max;
	}
	 public static void deleteMax(List<Integer> list, int max) {
		 Iterator<Integer> ite = list.iterator();
		 while(ite.hasNext()) {
			 int elm = ite.next();
			 if(elm == max) {
				 ite.remove();
               	 break;
			 }
		 }
	 }
	 public static int getSum(List<Integer> list) {
		 int sum = 0;
		 for(int elm: list) {
			 sum = sum + elm;
		 }
		 return sum;
	 }

} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		try(Scanner scan = new Scanner(System.in)){
			int N = Integer.parseInt(scan.next());//標準入力の数
			List<Integer> list = new ArrayList<Integer>();//標準入力格納リスト
			for(int i=0; i<N; i++) {//入力内容をリストに格納
				list.add(Integer.parseInt(scan.next()));
			}
			int turn = 1; // 1:Alice , -1:Bob
			List<Integer> aliceCard = new ArrayList<Integer>();//Alice's Card
			List<Integer> bobCard = new ArrayList<Integer>();// Bob's Card
			
			while(list.size() > 0) {
				int currentMax = getMax(list);
				if(turn == 1) {
					aliceCard.add(currentMax);
				}else{
					bobCard.add(currentMax);
				}
              	turn = turn * -1;
				deleteMax(list, currentMax);
			}
			int aliceSum = getSum(aliceCard);
			int bobSum = getSum(bobCard);
			System.out.println(aliceSum - bobSum);
			
			
		}
	} main {
		// TODO Auto-generated method stub
		try(Scanner scan = new Scanner(System.in)){
			int N = Integer.parseInt(scan.next());//標準入力の数
			List<Integer> list = new ArrayList<Integer>();//標準入力格納リスト
			for(int i=0; i<N; i++) {//入力内容をリストに格納
				list.add(Integer.parseInt(scan.next()));
			}
			int turn = 1; // 1:Alice , -1:Bob
			List<Integer> aliceCard = new ArrayList<Integer>();//Alice's Card
			List<Integer> bobCard = new ArrayList<Integer>();// Bob's Card
			
			while(list.size() > 0) {
				int currentMax = getMax(list);
				if(turn == 1) {
					aliceCard.add(currentMax);
				}else{
					bobCard.add(currentMax);
				}
              	turn = turn * -1;
				deleteMax(list, currentMax);
			}
			int aliceSum = getSum(aliceCard);
			int bobSum = getSum(bobCard);
			System.out.println(aliceSum - bobSum);
			
			
		}
	} try(Scanner scan = new Scanner(System.in)){
			int N = Integer.parseInt(scan.next());//標準入力の数
			List<Integer> list = new ArrayList<Integer>();//標準入力格納リスト
			for(int i=0; i<N; i++) {//入力内容をリストに格納
				list.add(Integer.parseInt(scan.next()));
			}
			int turn = 1; // 1:Alice , -1:Bob
			List<Integer> aliceCard = new ArrayList<Integer>();//Alice's Card
			List<Integer> bobCard = new ArrayList<Integer>();// Bob's Card
			
			while(list.size() > 0) {
				int currentMax = getMax(list);
				if(turn == 1) {
					aliceCard.add(currentMax);
				}else{
					bobCard.add(currentMax);
				}
              	turn = turn * -1;
				deleteMax(list, currentMax);
			}
			int aliceSum = getSum(aliceCard);
			int bobSum = getSum(bobCard);
			System.out.println(aliceSum - bobSum);
			
			
		} {
			int N = Integer.parseInt(scan.next());//標準入力の数
			List<Integer> list = new ArrayList<Integer>();//標準入力格納リスト
			for(int i=0; i<N; i++) {//入力内容をリストに格納
				list.add(Integer.parseInt(scan.next()));
			}
			int turn = 1; // 1:Alice , -1:Bob
			List<Integer> aliceCard = new ArrayList<Integer>();//Alice's Card
			List<Integer> bobCard = new ArrayList<Integer>();// Bob's Card
			
			while(list.size() > 0) {
				int currentMax = getMax(list);
				if(turn == 1) {
					aliceCard.add(currentMax);
				}else{
					bobCard.add(currentMax);
				}
              	turn = turn * -1;
				deleteMax(list, currentMax);
			}
			int aliceSum = getSum(aliceCard);
			int bobSum = getSum(bobCard);
			System.out.println(aliceSum - bobSum);
			
			
		} Scanner scan = new Scanner(System.in) Scanner scan = new Scanner(System.in) new Scanner(System.in) int N = Integer.parseInt(scan.next()); N Integer.parseInt(scan.next()) Integer.parseInt Integer scan.next() scan.next scan List<Integer> list = new ArrayList<Integer>(); list new ArrayList<Integer>() for(int i=0; i<N; i++) {//入力内容をリストに格納
				list.add(Integer.parseInt(scan.next()));
			} int i=0; int i=0; i 0 i<N i N i++ i++ i {//入力内容をリストに格納
				list.add(Integer.parseInt(scan.next()));
			} {//入力内容をリストに格納
				list.add(Integer.parseInt(scan.next()));
			} list.add(Integer.parseInt(scan.next())) list.add list Integer.parseInt(scan.next()) Integer.parseInt Integer scan.next() scan.next scan int turn = 1; turn 1 List<Integer> aliceCard = new ArrayList<Integer>(); aliceCard new ArrayList<Integer>() List<Integer> bobCard = new ArrayList<Integer>(); bobCard new ArrayList<Integer>() while(list.size() > 0) {
				int currentMax = getMax(list);
				if(turn == 1) {
					aliceCard.add(currentMax);
				}else{
					bobCard.add(currentMax);
				}
              	turn = turn * -1;
				deleteMax(list, currentMax);
			} list.size() > 0 list.size() list.size list 0 {
				int currentMax = getMax(list);
				if(turn == 1) {
					aliceCard.add(currentMax);
				}else{
					bobCard.add(currentMax);
				}
              	turn = turn * -1;
				deleteMax(list, currentMax);
			} int currentMax = getMax(list); currentMax getMax(list) getMax list if(turn == 1) {
					aliceCard.add(currentMax);
				}else{
					bobCard.add(currentMax);
				} turn == 1 turn 1 {
					aliceCard.add(currentMax);
				} aliceCard.add(currentMax) aliceCard.add aliceCard currentMax {
					bobCard.add(currentMax);
				} bobCard.add(currentMax) bobCard.add bobCard currentMax turn = turn * -1 turn turn * -1 turn -1 1 deleteMax(list, currentMax) deleteMax list currentMax int aliceSum = getSum(aliceCard); aliceSum getSum(aliceCard) getSum aliceCard int bobSum = getSum(bobCard); bobSum getSum(bobCard) getSum bobCard 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> list) {
		int max = 0;
		for(int num: list) {
			if(num > max) {
				max = num;
			}
		}
		return max;
	} getMax {
		int max = 0;
		for(int num: list) {
			if(num > max) {
				max = num;
			}
		}
		return max;
	} int max = 0; max 0 for(int num: list) {
			if(num > max) {
				max = num;
			}
		} int num list {
			if(num > max) {
				max = num;
			}
		} {
			if(num > max) {
				max = num;
			}
		} if(num > max) {
				max = num;
			} num > max num max {
				max = num;
			} max = num max num return max; max List<Integer> list list public static void deleteMax(List<Integer> list, int max) {
		 Iterator<Integer> ite = list.iterator();
		 while(ite.hasNext()) {
			 int elm = ite.next();
			 if(elm == max) {
				 ite.remove();
               	 break;
			 }
		 }
	 } deleteMax {
		 Iterator<Integer> ite = list.iterator();
		 while(ite.hasNext()) {
			 int elm = ite.next();
			 if(elm == max) {
				 ite.remove();
               	 break;
			 }
		 }
	 } Iterator<Integer> ite = list.iterator(); ite list.iterator() list.iterator list while(ite.hasNext()) {
			 int elm = ite.next();
			 if(elm == max) {
				 ite.remove();
               	 break;
			 }
		 } ite.hasNext() ite.hasNext ite {
			 int elm = ite.next();
			 if(elm == max) {
				 ite.remove();
               	 break;
			 }
		 } int elm = ite.next(); elm ite.next() ite.next ite if(elm == max) {
				 ite.remove();
               	 break;
			 } elm == max elm max {
				 ite.remove();
               	 break;
			 } ite.remove() ite.remove ite break; List<Integer> list list int max max public static int getSum(List<Integer> list) {
		 int sum = 0;
		 for(int elm: list) {
			 sum = sum + elm;
		 }
		 return sum;
	 } getSum {
		 int sum = 0;
		 for(int elm: list) {
			 sum = sum + elm;
		 }
		 return sum;
	 } int sum = 0; sum 0 for(int elm: list) {
			 sum = sum + elm;
		 } int elm list {
			 sum = sum + elm;
		 } {
			 sum = sum + elm;
		 } sum = sum + elm sum sum + elm sum elm return sum; sum List<Integer> list list public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try(Scanner scan = new Scanner(System.in)){
			int N = Integer.parseInt(scan.next());//標準入力の数
			List<Integer> list = new ArrayList<Integer>();//標準入力格納リスト
			for(int i=0; i<N; i++) {//入力内容をリストに格納
				list.add(Integer.parseInt(scan.next()));
			}
			int turn = 1; // 1:Alice , -1:Bob
			List<Integer> aliceCard = new ArrayList<Integer>();//Alice's Card
			List<Integer> bobCard = new ArrayList<Integer>();// Bob's Card
			
			while(list.size() > 0) {
				int currentMax = getMax(list);
				if(turn == 1) {
					aliceCard.add(currentMax);
				}else{
					bobCard.add(currentMax);
				}
              	turn = turn * -1;
				deleteMax(list, currentMax);
			}
			int aliceSum = getSum(aliceCard);
			int bobSum = getSum(bobCard);
			System.out.println(aliceSum - bobSum);
			
			
		}
	}
	public static int getMax(List<Integer> list) {
		int max = 0;
		for(int num: list) {
			if(num > max) {
				max = num;
			}
		}
		return max;
	}
	 public static void deleteMax(List<Integer> list, int max) {
		 Iterator<Integer> ite = list.iterator();
		 while(ite.hasNext()) {
			 int elm = ite.next();
			 if(elm == max) {
				 ite.remove();
               	 break;
			 }
		 }
	 }
	 public static int getSum(List<Integer> list) {
		 int sum = 0;
		 for(int elm: list) {
			 sum = sum + elm;
		 }
		 return sum;
	 }

} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try(Scanner scan = new Scanner(System.in)){
			int N = Integer.parseInt(scan.next());//標準入力の数
			List<Integer> list = new ArrayList<Integer>();//標準入力格納リスト
			for(int i=0; i<N; i++) {//入力内容をリストに格納
				list.add(Integer.parseInt(scan.next()));
			}
			int turn = 1; // 1:Alice , -1:Bob
			List<Integer> aliceCard = new ArrayList<Integer>();//Alice's Card
			List<Integer> bobCard = new ArrayList<Integer>();// Bob's Card
			
			while(list.size() > 0) {
				int currentMax = getMax(list);
				if(turn == 1) {
					aliceCard.add(currentMax);
				}else{
					bobCard.add(currentMax);
				}
              	turn = turn * -1;
				deleteMax(list, currentMax);
			}
			int aliceSum = getSum(aliceCard);
			int bobSum = getSum(bobCard);
			System.out.println(aliceSum - bobSum);
			
			
		}
	}
	public static int getMax(List<Integer> list) {
		int max = 0;
		for(int num: list) {
			if(num > max) {
				max = num;
			}
		}
		return max;
	}
	 public static void deleteMax(List<Integer> list, int max) {
		 Iterator<Integer> ite = list.iterator();
		 while(ite.hasNext()) {
			 int elm = ite.next();
			 if(elm == max) {
				 ite.remove();
               	 break;
			 }
		 }
	 }
	 public static int getSum(List<Integer> list) {
		 int sum = 0;
		 for(int elm: list) {
			 sum = sum + elm;
		 }
		 return sum;
	 }

} Main
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try(Scanner scan = new Scanner(System.in)){
			int N = Integer.parseInt(scan.next());//標準入力の数
			List<Integer> list = new ArrayList<Integer>();//標準入力格納リスト
			for(int i=0; i<N; i++) {//入力内容をリストに格納
				list.add(Integer.parseInt(scan.next()));
			}
			int turn = 1; // 1:Alice , -1:Bob
			List<Integer> aliceCard = new ArrayList<Integer>();//Alice's Card
			List<Integer> bobCard = new ArrayList<Integer>();// Bob's Card
			
			while(list.size() > 0) {
				int currentMax = getMax(list);
				if(turn == 1) {
					aliceCard.add(currentMax);
				}else{
					bobCard.add(currentMax);
				}
              	turn = turn * -1;
				deleteMax(list, currentMax);
			}
			int aliceSum = getSum(aliceCard);
			int bobSum = getSum(bobCard);
			System.out.println(aliceSum - bobSum);
			
			
		}
	}
	public static int getMax(List<Integer> list) {
		int max = 0;
		for(int num: list) {
			if(num > max) {
				max = num;
			}
		}
		return max;
	}
	 public static void deleteMax(List<Integer> list, int max) {
		 Iterator<Integer> ite = list.iterator();
		 while(ite.hasNext()) {
			 int elm = ite.next();
			 if(elm == max) {
				 ite.remove();
               	 break;
			 }
		 }
	 }
	 public static int getSum(List<Integer> list) {
		 int sum = 0;
		 for(int elm: list) {
			 sum = sum + elm;
		 }
		 return sum;
	 }

}
