import java.util.*;
public class Main {
	
	public static void main (String[]args) {
		Scanner sc = new Scanner(System.in);
		
		int N =  sc.nextInt();
		List<Integer> inputList = new ArrayList<Integer>();
		List<Integer> aliceList = new ArrayList<Integer>();
		List<Integer> bobList = new ArrayList<Integer>();
				
		for (int i = 0; i < N;i++) {
		
			int num = sc.nextInt();
		
			inputList.add(num);
		}
		
		Collections.sort(inputList,Collections.reverseOrder());
		boolean aliceFlg = true;
		
		for (int j = 0 ; j < inputList.size(); j++) {
			
			if (aliceFlg) {
				
				aliceList.add(inputList.get(j));
				aliceFlg = false;
			} else {
				
				bobList.add(inputList.get(j));
				aliceFlg = true;
			}
			
			
		}
		
		int aliceSum = 0;
		
		for (int aliceNum:aliceList) {
			aliceSum += aliceNum;
		}
		
		int bobSum = 0;
		
		for (int bobNum:bobList) {
			bobSum += bobNum;
		}
		
		System.out.println(aliceSum-bobSum);
			
	}	
} import java.util.*; util.* java public class Main {
	
	public static void main (String[]args) {
		Scanner sc = new Scanner(System.in);
		
		int N =  sc.nextInt();
		List<Integer> inputList = new ArrayList<Integer>();
		List<Integer> aliceList = new ArrayList<Integer>();
		List<Integer> bobList = new ArrayList<Integer>();
				
		for (int i = 0; i < N;i++) {
		
			int num = sc.nextInt();
		
			inputList.add(num);
		}
		
		Collections.sort(inputList,Collections.reverseOrder());
		boolean aliceFlg = true;
		
		for (int j = 0 ; j < inputList.size(); j++) {
			
			if (aliceFlg) {
				
				aliceList.add(inputList.get(j));
				aliceFlg = false;
			} else {
				
				bobList.add(inputList.get(j));
				aliceFlg = true;
			}
			
			
		}
		
		int aliceSum = 0;
		
		for (int aliceNum:aliceList) {
			aliceSum += aliceNum;
		}
		
		int bobSum = 0;
		
		for (int bobNum:bobList) {
			bobSum += bobNum;
		}
		
		System.out.println(aliceSum-bobSum);
			
	}	
} Main public static void main (String[]args) {
		Scanner sc = new Scanner(System.in);
		
		int N =  sc.nextInt();
		List<Integer> inputList = new ArrayList<Integer>();
		List<Integer> aliceList = new ArrayList<Integer>();
		List<Integer> bobList = new ArrayList<Integer>();
				
		for (int i = 0; i < N;i++) {
		
			int num = sc.nextInt();
		
			inputList.add(num);
		}
		
		Collections.sort(inputList,Collections.reverseOrder());
		boolean aliceFlg = true;
		
		for (int j = 0 ; j < inputList.size(); j++) {
			
			if (aliceFlg) {
				
				aliceList.add(inputList.get(j));
				aliceFlg = false;
			} else {
				
				bobList.add(inputList.get(j));
				aliceFlg = true;
			}
			
			
		}
		
		int aliceSum = 0;
		
		for (int aliceNum:aliceList) {
			aliceSum += aliceNum;
		}
		
		int bobSum = 0;
		
		for (int bobNum:bobList) {
			bobSum += bobNum;
		}
		
		System.out.println(aliceSum-bobSum);
			
	} main {
		Scanner sc = new Scanner(System.in);
		
		int N =  sc.nextInt();
		List<Integer> inputList = new ArrayList<Integer>();
		List<Integer> aliceList = new ArrayList<Integer>();
		List<Integer> bobList = new ArrayList<Integer>();
				
		for (int i = 0; i < N;i++) {
		
			int num = sc.nextInt();
		
			inputList.add(num);
		}
		
		Collections.sort(inputList,Collections.reverseOrder());
		boolean aliceFlg = true;
		
		for (int j = 0 ; j < inputList.size(); j++) {
			
			if (aliceFlg) {
				
				aliceList.add(inputList.get(j));
				aliceFlg = false;
			} else {
				
				bobList.add(inputList.get(j));
				aliceFlg = true;
			}
			
			
		}
		
		int aliceSum = 0;
		
		for (int aliceNum:aliceList) {
			aliceSum += aliceNum;
		}
		
		int bobSum = 0;
		
		for (int bobNum:bobList) {
			bobSum += bobNum;
		}
		
		System.out.println(aliceSum-bobSum);
			
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N =  sc.nextInt(); N sc.nextInt() sc.nextInt sc List<Integer> inputList = new ArrayList<Integer>(); inputList new ArrayList<Integer>() List<Integer> aliceList = new ArrayList<Integer>(); aliceList new ArrayList<Integer>() List<Integer> bobList = new ArrayList<Integer>(); bobList new ArrayList<Integer>() for (int i = 0; i < N;i++) {
		
			int num = sc.nextInt();
		
			inputList.add(num);
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
		
			int num = sc.nextInt();
		
			inputList.add(num);
		} {
		
			int num = sc.nextInt();
		
			inputList.add(num);
		} int num = sc.nextInt(); num sc.nextInt() sc.nextInt sc inputList.add(num) inputList.add inputList num Collections.sort(inputList,Collections.reverseOrder()) Collections.sort Collections inputList Collections.reverseOrder() Collections.reverseOrder Collections boolean aliceFlg = true; aliceFlg true for (int j = 0 ; j < inputList.size(); j++) {
			
			if (aliceFlg) {
				
				aliceList.add(inputList.get(j));
				aliceFlg = false;
			} else {
				
				bobList.add(inputList.get(j));
				aliceFlg = true;
			}
			
			
		} int j = 0 ; int j = 0 ; j 0 j < inputList.size() j inputList.size() inputList.size inputList j++ j++ j {
			
			if (aliceFlg) {
				
				aliceList.add(inputList.get(j));
				aliceFlg = false;
			} else {
				
				bobList.add(inputList.get(j));
				aliceFlg = true;
			}
			
			
		} {
			
			if (aliceFlg) {
				
				aliceList.add(inputList.get(j));
				aliceFlg = false;
			} else {
				
				bobList.add(inputList.get(j));
				aliceFlg = true;
			}
			
			
		} if (aliceFlg) {
				
				aliceList.add(inputList.get(j));
				aliceFlg = false;
			} else {
				
				bobList.add(inputList.get(j));
				aliceFlg = true;
			} aliceFlg {
				
				aliceList.add(inputList.get(j));
				aliceFlg = false;
			} aliceList.add(inputList.get(j)) aliceList.add aliceList inputList.get(j) inputList.get inputList j aliceFlg = false aliceFlg false {
				
				bobList.add(inputList.get(j));
				aliceFlg = true;
			} bobList.add(inputList.get(j)) bobList.add bobList inputList.get(j) inputList.get inputList j aliceFlg = true aliceFlg true int aliceSum = 0; aliceSum 0 for (int aliceNum:aliceList) {
			aliceSum += aliceNum;
		} int aliceNum aliceList {
			aliceSum += aliceNum;
		} {
			aliceSum += aliceNum;
		} aliceSum += aliceNum aliceSum aliceNum int bobSum = 0; bobSum 0 for (int bobNum:bobList) {
			bobSum += bobNum;
		} int bobNum bobList {
			bobSum += bobNum;
		} {
			bobSum += bobNum;
		} bobSum += bobNum bobSum bobNum System.out.println(aliceSum-bobSum) System.out.println System.out System System.out aliceSum-bobSum aliceSum bobSum String[]args args public class Main {
	
	public static void main (String[]args) {
		Scanner sc = new Scanner(System.in);
		
		int N =  sc.nextInt();
		List<Integer> inputList = new ArrayList<Integer>();
		List<Integer> aliceList = new ArrayList<Integer>();
		List<Integer> bobList = new ArrayList<Integer>();
				
		for (int i = 0; i < N;i++) {
		
			int num = sc.nextInt();
		
			inputList.add(num);
		}
		
		Collections.sort(inputList,Collections.reverseOrder());
		boolean aliceFlg = true;
		
		for (int j = 0 ; j < inputList.size(); j++) {
			
			if (aliceFlg) {
				
				aliceList.add(inputList.get(j));
				aliceFlg = false;
			} else {
				
				bobList.add(inputList.get(j));
				aliceFlg = true;
			}
			
			
		}
		
		int aliceSum = 0;
		
		for (int aliceNum:aliceList) {
			aliceSum += aliceNum;
		}
		
		int bobSum = 0;
		
		for (int bobNum:bobList) {
			bobSum += bobNum;
		}
		
		System.out.println(aliceSum-bobSum);
			
	}	
} public class Main {
	
	public static void main (String[]args) {
		Scanner sc = new Scanner(System.in);
		
		int N =  sc.nextInt();
		List<Integer> inputList = new ArrayList<Integer>();
		List<Integer> aliceList = new ArrayList<Integer>();
		List<Integer> bobList = new ArrayList<Integer>();
				
		for (int i = 0; i < N;i++) {
		
			int num = sc.nextInt();
		
			inputList.add(num);
		}
		
		Collections.sort(inputList,Collections.reverseOrder());
		boolean aliceFlg = true;
		
		for (int j = 0 ; j < inputList.size(); j++) {
			
			if (aliceFlg) {
				
				aliceList.add(inputList.get(j));
				aliceFlg = false;
			} else {
				
				bobList.add(inputList.get(j));
				aliceFlg = true;
			}
			
			
		}
		
		int aliceSum = 0;
		
		for (int aliceNum:aliceList) {
			aliceSum += aliceNum;
		}
		
		int bobSum = 0;
		
		for (int bobNum:bobList) {
			bobSum += bobNum;
		}
		
		System.out.println(aliceSum-bobSum);
			
	}	
} Main
import java.util.*;
public class Main {
	
	public static void main (String[]args) {
		Scanner sc = new Scanner(System.in);
		
		int N =  sc.nextInt();
		List<Integer> inputList = new ArrayList<Integer>();
		List<Integer> aliceList = new ArrayList<Integer>();
		List<Integer> bobList = new ArrayList<Integer>();
				
		for (int i = 0; i < N;i++) {
		
			int num = sc.nextInt();
		
			inputList.add(num);
		}
		
		Collections.sort(inputList,Collections.reverseOrder());
		boolean aliceFlg = true;
		
		for (int j = 0 ; j < inputList.size(); j++) {
			
			if (aliceFlg) {
				
				aliceList.add(inputList.get(j));
				aliceFlg = false;
			} else {
				
				bobList.add(inputList.get(j));
				aliceFlg = true;
			}
			
			
		}
		
		int aliceSum = 0;
		
		for (int aliceNum:aliceList) {
			aliceSum += aliceNum;
		}
		
		int bobSum = 0;
		
		for (int bobNum:bobList) {
			bobSum += bobNum;
		}
		
		System.out.println(aliceSum-bobSum);
			
	}	
}