import java.util.*;
public class Main{
    static int max(ArrayList<Integer> cards){
	int max = cards.get(0);
	int count = 0;
	for (int i = 0; i < cards.size(); i++){
	    if (max < cards.get(i)){
		max = cards.get(i);
		count = i;
	    }
	   
	}
	 return count;
    }
	
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	ArrayList<Integer> cards = new ArrayList<Integer>();
	for (int i = 0;i < N; i++){
	    cards.add(sc.nextInt());
	}
        int[] score = {0,0};
	int max = 0;
	int count = 0;
	while (cards.size() > 0){
	    score[count % 2] += cards.get(max(cards));
	    //System.out.println((count%2) + " " + score[count % 2]);
	    cards.remove(max(cards));
	    count++;
	}
	System.out.println(score[0] - score[1]);
    }
} import java.util.*; util.* java public class Main{
    static int max(ArrayList<Integer> cards){
	int max = cards.get(0);
	int count = 0;
	for (int i = 0; i < cards.size(); i++){
	    if (max < cards.get(i)){
		max = cards.get(i);
		count = i;
	    }
	   
	}
	 return count;
    }
	
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	ArrayList<Integer> cards = new ArrayList<Integer>();
	for (int i = 0;i < N; i++){
	    cards.add(sc.nextInt());
	}
        int[] score = {0,0};
	int max = 0;
	int count = 0;
	while (cards.size() > 0){
	    score[count % 2] += cards.get(max(cards));
	    //System.out.println((count%2) + " " + score[count % 2]);
	    cards.remove(max(cards));
	    count++;
	}
	System.out.println(score[0] - score[1]);
    }
} Main static int max(ArrayList<Integer> cards){
	int max = cards.get(0);
	int count = 0;
	for (int i = 0; i < cards.size(); i++){
	    if (max < cards.get(i)){
		max = cards.get(i);
		count = i;
	    }
	   
	}
	 return count;
    } max {
	int max = cards.get(0);
	int count = 0;
	for (int i = 0; i < cards.size(); i++){
	    if (max < cards.get(i)){
		max = cards.get(i);
		count = i;
	    }
	   
	}
	 return count;
    } int max = cards.get(0); max cards.get(0) cards.get cards 0 int count = 0; count 0 for (int i = 0; i < cards.size(); i++){
	    if (max < cards.get(i)){
		max = cards.get(i);
		count = i;
	    }
	   
	} int i = 0; int i = 0; i 0 i < cards.size() i cards.size() cards.size cards i++ i++ i {
	    if (max < cards.get(i)){
		max = cards.get(i);
		count = i;
	    }
	   
	} {
	    if (max < cards.get(i)){
		max = cards.get(i);
		count = i;
	    }
	   
	} if (max < cards.get(i)){
		max = cards.get(i);
		count = i;
	    } max < cards.get(i) max cards.get(i) cards.get cards i {
		max = cards.get(i);
		count = i;
	    } max = cards.get(i) max cards.get(i) cards.get cards i count = i count i return count; count ArrayList<Integer> cards cards public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	ArrayList<Integer> cards = new ArrayList<Integer>();
	for (int i = 0;i < N; i++){
	    cards.add(sc.nextInt());
	}
        int[] score = {0,0};
	int max = 0;
	int count = 0;
	while (cards.size() > 0){
	    score[count % 2] += cards.get(max(cards));
	    //System.out.println((count%2) + " " + score[count % 2]);
	    cards.remove(max(cards));
	    count++;
	}
	System.out.println(score[0] - score[1]);
    } main {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	ArrayList<Integer> cards = new ArrayList<Integer>();
	for (int i = 0;i < N; i++){
	    cards.add(sc.nextInt());
	}
        int[] score = {0,0};
	int max = 0;
	int count = 0;
	while (cards.size() > 0){
	    score[count % 2] += cards.get(max(cards));
	    //System.out.println((count%2) + " " + score[count % 2]);
	    cards.remove(max(cards));
	    count++;
	}
	System.out.println(score[0] - score[1]);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc ArrayList<Integer> cards = new ArrayList<Integer>(); cards new ArrayList<Integer>() for (int i = 0;i < N; i++){
	    cards.add(sc.nextInt());
	} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
	    cards.add(sc.nextInt());
	} {
	    cards.add(sc.nextInt());
	} cards.add(sc.nextInt()) cards.add cards sc.nextInt() sc.nextInt sc int[] score = {0,0}; score {0,0} 0 0 int max = 0; max 0 int count = 0; count 0 while (cards.size() > 0){
	    score[count % 2] += cards.get(max(cards));
	    //System.out.println((count%2) + " " + score[count % 2]);
	    cards.remove(max(cards));
	    count++;
	} cards.size() > 0 cards.size() cards.size cards 0 {
	    score[count % 2] += cards.get(max(cards));
	    //System.out.println((count%2) + " " + score[count % 2]);
	    cards.remove(max(cards));
	    count++;
	} score[count % 2] += cards.get(max(cards)) score[count % 2] score count % 2 count 2 cards.get(max(cards)) cards.get cards max(cards) max cards cards.remove(max(cards)) cards.remove cards max(cards) max cards count++ count System.out.println(score[0] - score[1]) System.out.println System.out System System.out score[0] - score[1] score[0] score 0 score[1] score 1 String[] args args public class Main{
    static int max(ArrayList<Integer> cards){
	int max = cards.get(0);
	int count = 0;
	for (int i = 0; i < cards.size(); i++){
	    if (max < cards.get(i)){
		max = cards.get(i);
		count = i;
	    }
	   
	}
	 return count;
    }
	
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	ArrayList<Integer> cards = new ArrayList<Integer>();
	for (int i = 0;i < N; i++){
	    cards.add(sc.nextInt());
	}
        int[] score = {0,0};
	int max = 0;
	int count = 0;
	while (cards.size() > 0){
	    score[count % 2] += cards.get(max(cards));
	    //System.out.println((count%2) + " " + score[count % 2]);
	    cards.remove(max(cards));
	    count++;
	}
	System.out.println(score[0] - score[1]);
    }
} public class Main{
    static int max(ArrayList<Integer> cards){
	int max = cards.get(0);
	int count = 0;
	for (int i = 0; i < cards.size(); i++){
	    if (max < cards.get(i)){
		max = cards.get(i);
		count = i;
	    }
	   
	}
	 return count;
    }
	
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	ArrayList<Integer> cards = new ArrayList<Integer>();
	for (int i = 0;i < N; i++){
	    cards.add(sc.nextInt());
	}
        int[] score = {0,0};
	int max = 0;
	int count = 0;
	while (cards.size() > 0){
	    score[count % 2] += cards.get(max(cards));
	    //System.out.println((count%2) + " " + score[count % 2]);
	    cards.remove(max(cards));
	    count++;
	}
	System.out.println(score[0] - score[1]);
    }
} Main
import java.util.*;
public class Main{
    static int max(ArrayList<Integer> cards){
	int max = cards.get(0);
	int count = 0;
	for (int i = 0; i < cards.size(); i++){
	    if (max < cards.get(i)){
		max = cards.get(i);
		count = i;
	    }
	   
	}
	 return count;
    }
	
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	ArrayList<Integer> cards = new ArrayList<Integer>();
	for (int i = 0;i < N; i++){
	    cards.add(sc.nextInt());
	}
        int[] score = {0,0};
	int max = 0;
	int count = 0;
	while (cards.size() > 0){
	    score[count % 2] += cards.get(max(cards));
	    //System.out.println((count%2) + " " + score[count % 2]);
	    cards.remove(max(cards));
	    count++;
	}
	System.out.println(score[0] - score[1]);
    }
}
