import java.util.*;
public class Main{
	
	public static void main (String[] args) {
		
		Scanner scanner = new Scanner (System.in);
		
		int totalCard = scanner.nextInt();
		int [] cardList = new int[totalCard];
		
		for (int index=0; index<totalCard; index++) {
			int temp = scanner.nextInt();
			cardList[index]=temp;
		}
		
		int alicePoint = 0;
		int bobPoint = 0;
		
		boolean aliceTurn = true;
		for (int index=0; index<totalCard; index++) {
			
			int card = getMaximum(cardList);
			if (aliceTurn==true) {
				alicePoint+=card;
				aliceTurn = false;
			} else {
				bobPoint+=card;
				aliceTurn = true;
			}
		}
		
		System.out.println(Math.abs(alicePoint-bobPoint));
		
	}
	
	static int getMaximum (int[] cardList) {
		
		int maximum = 0;
		int maximumIndex = 0;
		
		for (int index=0; index<cardList.length; index++) {
			int temp = cardList[index];
			if (temp>maximum) {
				maximum=temp;
				maximumIndex=index;
			}
		}
		cardList[maximumIndex]=0;
		return maximum;
	}
} import java.util.*; util.* java public class Main{
	
	public static void main (String[] args) {
		
		Scanner scanner = new Scanner (System.in);
		
		int totalCard = scanner.nextInt();
		int [] cardList = new int[totalCard];
		
		for (int index=0; index<totalCard; index++) {
			int temp = scanner.nextInt();
			cardList[index]=temp;
		}
		
		int alicePoint = 0;
		int bobPoint = 0;
		
		boolean aliceTurn = true;
		for (int index=0; index<totalCard; index++) {
			
			int card = getMaximum(cardList);
			if (aliceTurn==true) {
				alicePoint+=card;
				aliceTurn = false;
			} else {
				bobPoint+=card;
				aliceTurn = true;
			}
		}
		
		System.out.println(Math.abs(alicePoint-bobPoint));
		
	}
	
	static int getMaximum (int[] cardList) {
		
		int maximum = 0;
		int maximumIndex = 0;
		
		for (int index=0; index<cardList.length; index++) {
			int temp = cardList[index];
			if (temp>maximum) {
				maximum=temp;
				maximumIndex=index;
			}
		}
		cardList[maximumIndex]=0;
		return maximum;
	}
} Main public static void main (String[] args) {
		
		Scanner scanner = new Scanner (System.in);
		
		int totalCard = scanner.nextInt();
		int [] cardList = new int[totalCard];
		
		for (int index=0; index<totalCard; index++) {
			int temp = scanner.nextInt();
			cardList[index]=temp;
		}
		
		int alicePoint = 0;
		int bobPoint = 0;
		
		boolean aliceTurn = true;
		for (int index=0; index<totalCard; index++) {
			
			int card = getMaximum(cardList);
			if (aliceTurn==true) {
				alicePoint+=card;
				aliceTurn = false;
			} else {
				bobPoint+=card;
				aliceTurn = true;
			}
		}
		
		System.out.println(Math.abs(alicePoint-bobPoint));
		
	} main {
		
		Scanner scanner = new Scanner (System.in);
		
		int totalCard = scanner.nextInt();
		int [] cardList = new int[totalCard];
		
		for (int index=0; index<totalCard; index++) {
			int temp = scanner.nextInt();
			cardList[index]=temp;
		}
		
		int alicePoint = 0;
		int bobPoint = 0;
		
		boolean aliceTurn = true;
		for (int index=0; index<totalCard; index++) {
			
			int card = getMaximum(cardList);
			if (aliceTurn==true) {
				alicePoint+=card;
				aliceTurn = false;
			} else {
				bobPoint+=card;
				aliceTurn = true;
			}
		}
		
		System.out.println(Math.abs(alicePoint-bobPoint));
		
	} Scanner scanner = new Scanner (System.in); scanner new Scanner (System.in) int totalCard = scanner.nextInt(); totalCard scanner.nextInt() scanner.nextInt scanner int [] cardList = new int[totalCard]; cardList new int[totalCard] totalCard for (int index=0; index<totalCard; index++) {
			int temp = scanner.nextInt();
			cardList[index]=temp;
		} int index=0; int index=0; index 0 index<totalCard index totalCard index++ index++ index {
			int temp = scanner.nextInt();
			cardList[index]=temp;
		} {
			int temp = scanner.nextInt();
			cardList[index]=temp;
		} int temp = scanner.nextInt(); temp scanner.nextInt() scanner.nextInt scanner cardList[index]=temp cardList[index] cardList index temp int alicePoint = 0; alicePoint 0 int bobPoint = 0; bobPoint 0 boolean aliceTurn = true; aliceTurn true for (int index=0; index<totalCard; index++) {
			
			int card = getMaximum(cardList);
			if (aliceTurn==true) {
				alicePoint+=card;
				aliceTurn = false;
			} else {
				bobPoint+=card;
				aliceTurn = true;
			}
		} int index=0; int index=0; index 0 index<totalCard index totalCard index++ index++ index {
			
			int card = getMaximum(cardList);
			if (aliceTurn==true) {
				alicePoint+=card;
				aliceTurn = false;
			} else {
				bobPoint+=card;
				aliceTurn = true;
			}
		} {
			
			int card = getMaximum(cardList);
			if (aliceTurn==true) {
				alicePoint+=card;
				aliceTurn = false;
			} else {
				bobPoint+=card;
				aliceTurn = true;
			}
		} int card = getMaximum(cardList); card getMaximum(cardList) getMaximum cardList if (aliceTurn==true) {
				alicePoint+=card;
				aliceTurn = false;
			} else {
				bobPoint+=card;
				aliceTurn = true;
			} aliceTurn==true aliceTurn true {
				alicePoint+=card;
				aliceTurn = false;
			} alicePoint+=card alicePoint card aliceTurn = false aliceTurn false {
				bobPoint+=card;
				aliceTurn = true;
			} bobPoint+=card bobPoint card aliceTurn = true aliceTurn true System.out.println(Math.abs(alicePoint-bobPoint)) System.out.println System.out System System.out Math.abs(alicePoint-bobPoint) Math.abs Math alicePoint-bobPoint alicePoint bobPoint String[] args args static int getMaximum (int[] cardList) {
		
		int maximum = 0;
		int maximumIndex = 0;
		
		for (int index=0; index<cardList.length; index++) {
			int temp = cardList[index];
			if (temp>maximum) {
				maximum=temp;
				maximumIndex=index;
			}
		}
		cardList[maximumIndex]=0;
		return maximum;
	} getMaximum {
		
		int maximum = 0;
		int maximumIndex = 0;
		
		for (int index=0; index<cardList.length; index++) {
			int temp = cardList[index];
			if (temp>maximum) {
				maximum=temp;
				maximumIndex=index;
			}
		}
		cardList[maximumIndex]=0;
		return maximum;
	} int maximum = 0; maximum 0 int maximumIndex = 0; maximumIndex 0 for (int index=0; index<cardList.length; index++) {
			int temp = cardList[index];
			if (temp>maximum) {
				maximum=temp;
				maximumIndex=index;
			}
		} int index=0; int index=0; index 0 index<cardList.length index cardList.length cardList cardList.length index++ index++ index {
			int temp = cardList[index];
			if (temp>maximum) {
				maximum=temp;
				maximumIndex=index;
			}
		} {
			int temp = cardList[index];
			if (temp>maximum) {
				maximum=temp;
				maximumIndex=index;
			}
		} int temp = cardList[index]; temp cardList[index] cardList index if (temp>maximum) {
				maximum=temp;
				maximumIndex=index;
			} temp>maximum temp maximum {
				maximum=temp;
				maximumIndex=index;
			} maximum=temp maximum temp maximumIndex=index maximumIndex index cardList[maximumIndex]=0 cardList[maximumIndex] cardList maximumIndex 0 return maximum; maximum int[] cardList cardList public class Main{
	
	public static void main (String[] args) {
		
		Scanner scanner = new Scanner (System.in);
		
		int totalCard = scanner.nextInt();
		int [] cardList = new int[totalCard];
		
		for (int index=0; index<totalCard; index++) {
			int temp = scanner.nextInt();
			cardList[index]=temp;
		}
		
		int alicePoint = 0;
		int bobPoint = 0;
		
		boolean aliceTurn = true;
		for (int index=0; index<totalCard; index++) {
			
			int card = getMaximum(cardList);
			if (aliceTurn==true) {
				alicePoint+=card;
				aliceTurn = false;
			} else {
				bobPoint+=card;
				aliceTurn = true;
			}
		}
		
		System.out.println(Math.abs(alicePoint-bobPoint));
		
	}
	
	static int getMaximum (int[] cardList) {
		
		int maximum = 0;
		int maximumIndex = 0;
		
		for (int index=0; index<cardList.length; index++) {
			int temp = cardList[index];
			if (temp>maximum) {
				maximum=temp;
				maximumIndex=index;
			}
		}
		cardList[maximumIndex]=0;
		return maximum;
	}
} public class Main{
	
	public static void main (String[] args) {
		
		Scanner scanner = new Scanner (System.in);
		
		int totalCard = scanner.nextInt();
		int [] cardList = new int[totalCard];
		
		for (int index=0; index<totalCard; index++) {
			int temp = scanner.nextInt();
			cardList[index]=temp;
		}
		
		int alicePoint = 0;
		int bobPoint = 0;
		
		boolean aliceTurn = true;
		for (int index=0; index<totalCard; index++) {
			
			int card = getMaximum(cardList);
			if (aliceTurn==true) {
				alicePoint+=card;
				aliceTurn = false;
			} else {
				bobPoint+=card;
				aliceTurn = true;
			}
		}
		
		System.out.println(Math.abs(alicePoint-bobPoint));
		
	}
	
	static int getMaximum (int[] cardList) {
		
		int maximum = 0;
		int maximumIndex = 0;
		
		for (int index=0; index<cardList.length; index++) {
			int temp = cardList[index];
			if (temp>maximum) {
				maximum=temp;
				maximumIndex=index;
			}
		}
		cardList[maximumIndex]=0;
		return maximum;
	}
} Main
import java.util.*;
public class Main{
	
	public static void main (String[] args) {
		
		Scanner scanner = new Scanner (System.in);
		
		int totalCard = scanner.nextInt();
		int [] cardList = new int[totalCard];
		
		for (int index=0; index<totalCard; index++) {
			int temp = scanner.nextInt();
			cardList[index]=temp;
		}
		
		int alicePoint = 0;
		int bobPoint = 0;
		
		boolean aliceTurn = true;
		for (int index=0; index<totalCard; index++) {
			
			int card = getMaximum(cardList);
			if (aliceTurn==true) {
				alicePoint+=card;
				aliceTurn = false;
			} else {
				bobPoint+=card;
				aliceTurn = true;
			}
		}
		
		System.out.println(Math.abs(alicePoint-bobPoint));
		
	}
	
	static int getMaximum (int[] cardList) {
		
		int maximum = 0;
		int maximumIndex = 0;
		
		for (int index=0; index<cardList.length; index++) {
			int temp = cardList[index];
			if (temp>maximum) {
				maximum=temp;
				maximumIndex=index;
			}
		}
		cardList[maximumIndex]=0;
		return maximum;
	}
}