import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int num = sc.nextInt(); //枚数
	int alice = 0; //アリスの合計点
	int bob = 0; //ボブの合計点
	ArrayList<Integer> cardList = new ArrayList<>();
	for(int i=0; i<num; i++){
		cardList.add(sc.nextInt());
	}
	//降順でソート
	Collections.sort(cardList, Collections.reverseOrder());
	
	int turn=1;
	for(int card:cardList){
		if(turn%2 == 1){
			alice = alice+card;
		}else{
			bob = bob+card;
		}
		turn++;
	}
	System.out.println(alice - bob);
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int num = sc.nextInt(); //枚数
	int alice = 0; //アリスの合計点
	int bob = 0; //ボブの合計点
	ArrayList<Integer> cardList = new ArrayList<>();
	for(int i=0; i<num; i++){
		cardList.add(sc.nextInt());
	}
	//降順でソート
	Collections.sort(cardList, Collections.reverseOrder());
	
	int turn=1;
	for(int card:cardList){
		if(turn%2 == 1){
			alice = alice+card;
		}else{
			bob = bob+card;
		}
		turn++;
	}
	System.out.println(alice - bob);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int num = sc.nextInt(); //枚数
	int alice = 0; //アリスの合計点
	int bob = 0; //ボブの合計点
	ArrayList<Integer> cardList = new ArrayList<>();
	for(int i=0; i<num; i++){
		cardList.add(sc.nextInt());
	}
	//降順でソート
	Collections.sort(cardList, Collections.reverseOrder());
	
	int turn=1;
	for(int card:cardList){
		if(turn%2 == 1){
			alice = alice+card;
		}else{
			bob = bob+card;
		}
		turn++;
	}
	System.out.println(alice - bob);
  } main {
    Scanner sc = new Scanner(System.in);
    int num = sc.nextInt(); //枚数
	int alice = 0; //アリスの合計点
	int bob = 0; //ボブの合計点
	ArrayList<Integer> cardList = new ArrayList<>();
	for(int i=0; i<num; i++){
		cardList.add(sc.nextInt());
	}
	//降順でソート
	Collections.sort(cardList, Collections.reverseOrder());
	
	int turn=1;
	for(int card:cardList){
		if(turn%2 == 1){
			alice = alice+card;
		}else{
			bob = bob+card;
		}
		turn++;
	}
	System.out.println(alice - bob);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int num = sc.nextInt(); num sc.nextInt() sc.nextInt sc int alice = 0; alice 0 int bob = 0; bob 0 ArrayList<Integer> cardList = new ArrayList<>(); cardList new ArrayList<>() for(int i=0; i<num; i++){
		cardList.add(sc.nextInt());
	} int i=0; int i=0; i 0 i<num i num i++ i++ i {
		cardList.add(sc.nextInt());
	} {
		cardList.add(sc.nextInt());
	} cardList.add(sc.nextInt()) cardList.add cardList sc.nextInt() sc.nextInt sc Collections.sort(cardList, Collections.reverseOrder()) Collections.sort Collections cardList Collections.reverseOrder() Collections.reverseOrder Collections int turn=1; turn 1 for(int card:cardList){
		if(turn%2 == 1){
			alice = alice+card;
		}else{
			bob = bob+card;
		}
		turn++;
	} int card cardList {
		if(turn%2 == 1){
			alice = alice+card;
		}else{
			bob = bob+card;
		}
		turn++;
	} {
		if(turn%2 == 1){
			alice = alice+card;
		}else{
			bob = bob+card;
		}
		turn++;
	} if(turn%2 == 1){
			alice = alice+card;
		}else{
			bob = bob+card;
		} turn%2 == 1 turn%2 turn 2 1 {
			alice = alice+card;
		} alice = alice+card alice alice+card alice card {
			bob = bob+card;
		} bob = bob+card bob bob+card bob card turn++ turn System.out.println(alice - bob) System.out.println System.out System System.out alice - bob alice bob String[] args args public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int num = sc.nextInt(); //枚数
	int alice = 0; //アリスの合計点
	int bob = 0; //ボブの合計点
	ArrayList<Integer> cardList = new ArrayList<>();
	for(int i=0; i<num; i++){
		cardList.add(sc.nextInt());
	}
	//降順でソート
	Collections.sort(cardList, Collections.reverseOrder());
	
	int turn=1;
	for(int card:cardList){
		if(turn%2 == 1){
			alice = alice+card;
		}else{
			bob = bob+card;
		}
		turn++;
	}
	System.out.println(alice - bob);
  }
} public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int num = sc.nextInt(); //枚数
	int alice = 0; //アリスの合計点
	int bob = 0; //ボブの合計点
	ArrayList<Integer> cardList = new ArrayList<>();
	for(int i=0; i<num; i++){
		cardList.add(sc.nextInt());
	}
	//降順でソート
	Collections.sort(cardList, Collections.reverseOrder());
	
	int turn=1;
	for(int card:cardList){
		if(turn%2 == 1){
			alice = alice+card;
		}else{
			bob = bob+card;
		}
		turn++;
	}
	System.out.println(alice - bob);
  }
} Main
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int num = sc.nextInt(); //枚数
	int alice = 0; //アリスの合計点
	int bob = 0; //ボブの合計点
	ArrayList<Integer> cardList = new ArrayList<>();
	for(int i=0; i<num; i++){
		cardList.add(sc.nextInt());
	}
	//降順でソート
	Collections.sort(cardList, Collections.reverseOrder());
	
	int turn=1;
	for(int card:cardList){
		if(turn%2 == 1){
			alice = alice+card;
		}else{
			bob = bob+card;
		}
		turn++;
	}
	System.out.println(alice - bob);
  }
}