import static java.util.Arrays.sort;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int scoreCard[] = new int[N];
        
        for(int i = 0; i < N; i++){
            scoreCard[i] = sc.nextInt();
        //    System.out.println(scoreCard[i]);
        }
        
        sort(scoreCard);
        /*
        for(int num : scoreCard){
            System.out.println(num);
        }
        */
        int Alice = 0, Bob = 0;
        boolean flg = true;
        for(int i = scoreCard.length -1; i >= 0; i--){
            if(flg){
                Alice += scoreCard[i];
        //        System.out.println("A" + Alice);
                flg = false;
            }else{
                Bob += scoreCard[i];
        //        System.out.println("B" + Bob);
                flg = true;
            }
        }
        System.out.println(Alice - Bob);
        
    }

} import static java.util.Arrays.sort; import static java.util.Arrays.sort; import static java.util.Arrays.sort; import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int scoreCard[] = new int[N];
        
        for(int i = 0; i < N; i++){
            scoreCard[i] = sc.nextInt();
        //    System.out.println(scoreCard[i]);
        }
        
        sort(scoreCard);
        /*
        for(int num : scoreCard){
            System.out.println(num);
        }
        */
        int Alice = 0, Bob = 0;
        boolean flg = true;
        for(int i = scoreCard.length -1; i >= 0; i--){
            if(flg){
                Alice += scoreCard[i];
        //        System.out.println("A" + Alice);
                flg = false;
            }else{
                Bob += scoreCard[i];
        //        System.out.println("B" + Bob);
                flg = true;
            }
        }
        System.out.println(Alice - Bob);
        
    }

} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int scoreCard[] = new int[N];
        
        for(int i = 0; i < N; i++){
            scoreCard[i] = sc.nextInt();
        //    System.out.println(scoreCard[i]);
        }
        
        sort(scoreCard);
        /*
        for(int num : scoreCard){
            System.out.println(num);
        }
        */
        int Alice = 0, Bob = 0;
        boolean flg = true;
        for(int i = scoreCard.length -1; i >= 0; i--){
            if(flg){
                Alice += scoreCard[i];
        //        System.out.println("A" + Alice);
                flg = false;
            }else{
                Bob += scoreCard[i];
        //        System.out.println("B" + Bob);
                flg = true;
            }
        }
        System.out.println(Alice - Bob);
        
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int scoreCard[] = new int[N];
        
        for(int i = 0; i < N; i++){
            scoreCard[i] = sc.nextInt();
        //    System.out.println(scoreCard[i]);
        }
        
        sort(scoreCard);
        /*
        for(int num : scoreCard){
            System.out.println(num);
        }
        */
        int Alice = 0, Bob = 0;
        boolean flg = true;
        for(int i = scoreCard.length -1; i >= 0; i--){
            if(flg){
                Alice += scoreCard[i];
        //        System.out.println("A" + Alice);
                flg = false;
            }else{
                Bob += scoreCard[i];
        //        System.out.println("B" + Bob);
                flg = true;
            }
        }
        System.out.println(Alice - Bob);
        
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int scoreCard[] = new int[N]; scoreCard new int[N] N for(int i = 0; i < N; i++){
            scoreCard[i] = sc.nextInt();
        //    System.out.println(scoreCard[i]);
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            scoreCard[i] = sc.nextInt();
        //    System.out.println(scoreCard[i]);
        } {
            scoreCard[i] = sc.nextInt();
        //    System.out.println(scoreCard[i]);
        } scoreCard[i] = sc.nextInt() scoreCard[i] scoreCard i sc.nextInt() sc.nextInt sc sort(scoreCard) sort scoreCard int Alice = 0 Alice 0 Bob = 0; Bob 0 boolean flg = true; flg true for(int i = scoreCard.length -1; i >= 0; i--){
            if(flg){
                Alice += scoreCard[i];
        //        System.out.println("A" + Alice);
                flg = false;
            }else{
                Bob += scoreCard[i];
        //        System.out.println("B" + Bob);
                flg = true;
            }
        } int i = scoreCard.length -1; int i = scoreCard.length -1; i scoreCard.length -1 scoreCard.length scoreCard scoreCard.length 1 i >= 0 i 0 i-- i-- i {
            if(flg){
                Alice += scoreCard[i];
        //        System.out.println("A" + Alice);
                flg = false;
            }else{
                Bob += scoreCard[i];
        //        System.out.println("B" + Bob);
                flg = true;
            }
        } {
            if(flg){
                Alice += scoreCard[i];
        //        System.out.println("A" + Alice);
                flg = false;
            }else{
                Bob += scoreCard[i];
        //        System.out.println("B" + Bob);
                flg = true;
            }
        } if(flg){
                Alice += scoreCard[i];
        //        System.out.println("A" + Alice);
                flg = false;
            }else{
                Bob += scoreCard[i];
        //        System.out.println("B" + Bob);
                flg = true;
            } flg {
                Alice += scoreCard[i];
        //        System.out.println("A" + Alice);
                flg = false;
            } Alice += scoreCard[i] Alice scoreCard[i] scoreCard i flg = false flg false {
                Bob += scoreCard[i];
        //        System.out.println("B" + Bob);
                flg = true;
            } Bob += scoreCard[i] Bob scoreCard[i] scoreCard i flg = true flg true 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 N = sc.nextInt();
        int scoreCard[] = new int[N];
        
        for(int i = 0; i < N; i++){
            scoreCard[i] = sc.nextInt();
        //    System.out.println(scoreCard[i]);
        }
        
        sort(scoreCard);
        /*
        for(int num : scoreCard){
            System.out.println(num);
        }
        */
        int Alice = 0, Bob = 0;
        boolean flg = true;
        for(int i = scoreCard.length -1; i >= 0; i--){
            if(flg){
                Alice += scoreCard[i];
        //        System.out.println("A" + Alice);
                flg = false;
            }else{
                Bob += scoreCard[i];
        //        System.out.println("B" + Bob);
                flg = true;
            }
        }
        System.out.println(Alice - Bob);
        
    }

} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int scoreCard[] = new int[N];
        
        for(int i = 0; i < N; i++){
            scoreCard[i] = sc.nextInt();
        //    System.out.println(scoreCard[i]);
        }
        
        sort(scoreCard);
        /*
        for(int num : scoreCard){
            System.out.println(num);
        }
        */
        int Alice = 0, Bob = 0;
        boolean flg = true;
        for(int i = scoreCard.length -1; i >= 0; i--){
            if(flg){
                Alice += scoreCard[i];
        //        System.out.println("A" + Alice);
                flg = false;
            }else{
                Bob += scoreCard[i];
        //        System.out.println("B" + Bob);
                flg = true;
            }
        }
        System.out.println(Alice - Bob);
        
    }

} Main
import static java.util.Arrays.sort;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int scoreCard[] = new int[N];
        
        for(int i = 0; i < N; i++){
            scoreCard[i] = sc.nextInt();
        //    System.out.println(scoreCard[i]);
        }
        
        sort(scoreCard);
        /*
        for(int num : scoreCard){
            System.out.println(num);
        }
        */
        int Alice = 0, Bob = 0;
        boolean flg = true;
        for(int i = scoreCard.length -1; i >= 0; i--){
            if(flg){
                Alice += scoreCard[i];
        //        System.out.println("A" + Alice);
                flg = false;
            }else{
                Bob += scoreCard[i];
        //        System.out.println("B" + Bob);
                flg = true;
            }
        }
        System.out.println(Alice - Bob);
        
    }

}
