import java.util.Arrays;
import java.io.*;

public class Main{
    public static void  main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int cards = Integer.parseInt(br.readLine());
        int[] card = new int[cards];
        String  input = br.readLine();

        for(int i = 0; i<cards-1; i++){
            card[i] = Integer.parseInt(input.substring(0,input.indexOf(" ")));
            input = input.substring(input.indexOf(" ")+1);
        }
        card[cards-1] = Integer.parseInt(input);
        Arrays.sort(card);

        int Bob = 0;
        int Alice = 0;
        boolean isAliceTurn = cards%2 == 1;

        for(int a_card : card){
            if(isAliceTurn){
                Alice += a_card;
                isAliceTurn = false;
            }
            else{
                Bob += a_card;
                isAliceTurn = true;
            }
        }
    System.out.println(Alice - Bob);
    }
} import java.util.Arrays; Arrays java.util import java.io.*; io.* java public class Main{
    public static void  main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int cards = Integer.parseInt(br.readLine());
        int[] card = new int[cards];
        String  input = br.readLine();

        for(int i = 0; i<cards-1; i++){
            card[i] = Integer.parseInt(input.substring(0,input.indexOf(" ")));
            input = input.substring(input.indexOf(" ")+1);
        }
        card[cards-1] = Integer.parseInt(input);
        Arrays.sort(card);

        int Bob = 0;
        int Alice = 0;
        boolean isAliceTurn = cards%2 == 1;

        for(int a_card : card){
            if(isAliceTurn){
                Alice += a_card;
                isAliceTurn = false;
            }
            else{
                Bob += a_card;
                isAliceTurn = true;
            }
        }
    System.out.println(Alice - Bob);
    }
} Main public static void  main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int cards = Integer.parseInt(br.readLine());
        int[] card = new int[cards];
        String  input = br.readLine();

        for(int i = 0; i<cards-1; i++){
            card[i] = Integer.parseInt(input.substring(0,input.indexOf(" ")));
            input = input.substring(input.indexOf(" ")+1);
        }
        card[cards-1] = Integer.parseInt(input);
        Arrays.sort(card);

        int Bob = 0;
        int Alice = 0;
        boolean isAliceTurn = cards%2 == 1;

        for(int a_card : card){
            if(isAliceTurn){
                Alice += a_card;
                isAliceTurn = false;
            }
            else{
                Bob += a_card;
                isAliceTurn = true;
            }
        }
    System.out.println(Alice - Bob);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int cards = Integer.parseInt(br.readLine());
        int[] card = new int[cards];
        String  input = br.readLine();

        for(int i = 0; i<cards-1; i++){
            card[i] = Integer.parseInt(input.substring(0,input.indexOf(" ")));
            input = input.substring(input.indexOf(" ")+1);
        }
        card[cards-1] = Integer.parseInt(input);
        Arrays.sort(card);

        int Bob = 0;
        int Alice = 0;
        boolean isAliceTurn = cards%2 == 1;

        for(int a_card : card){
            if(isAliceTurn){
                Alice += a_card;
                isAliceTurn = false;
            }
            else{
                Bob += a_card;
                isAliceTurn = true;
            }
        }
    System.out.println(Alice - Bob);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int cards = Integer.parseInt(br.readLine()); cards Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int[] card = new int[cards]; card new int[cards] cards String  input = br.readLine(); input br.readLine() br.readLine br for(int i = 0; i<cards-1; i++){
            card[i] = Integer.parseInt(input.substring(0,input.indexOf(" ")));
            input = input.substring(input.indexOf(" ")+1);
        } int i = 0; int i = 0; i 0 i<cards-1 i cards-1 cards 1 i++ i++ i {
            card[i] = Integer.parseInt(input.substring(0,input.indexOf(" ")));
            input = input.substring(input.indexOf(" ")+1);
        } {
            card[i] = Integer.parseInt(input.substring(0,input.indexOf(" ")));
            input = input.substring(input.indexOf(" ")+1);
        } card[i] = Integer.parseInt(input.substring(0,input.indexOf(" "))) card[i] card i Integer.parseInt(input.substring(0,input.indexOf(" "))) Integer.parseInt Integer input.substring(0,input.indexOf(" ")) input.substring input 0 input.indexOf(" ") input.indexOf input " " input = input.substring(input.indexOf(" ")+1) input input.substring(input.indexOf(" ")+1) input.substring input input.indexOf(" ")+1 input.indexOf(" ") input.indexOf input " " 1 card[cards-1] = Integer.parseInt(input) card[cards-1] card cards-1 cards 1 Integer.parseInt(input) Integer.parseInt Integer input Arrays.sort(card) Arrays.sort Arrays card int Bob = 0; Bob 0 int Alice = 0; Alice 0 boolean isAliceTurn = cards%2 == 1; isAliceTurn cards%2 == 1 cards%2 cards 2 1 for(int a_card : card){
            if(isAliceTurn){
                Alice += a_card;
                isAliceTurn = false;
            }
            else{
                Bob += a_card;
                isAliceTurn = true;
            }
        } int a_card card {
            if(isAliceTurn){
                Alice += a_card;
                isAliceTurn = false;
            }
            else{
                Bob += a_card;
                isAliceTurn = true;
            }
        } {
            if(isAliceTurn){
                Alice += a_card;
                isAliceTurn = false;
            }
            else{
                Bob += a_card;
                isAliceTurn = true;
            }
        } if(isAliceTurn){
                Alice += a_card;
                isAliceTurn = false;
            }
            else{
                Bob += a_card;
                isAliceTurn = true;
            } isAliceTurn {
                Alice += a_card;
                isAliceTurn = false;
            } Alice += a_card Alice a_card isAliceTurn = false isAliceTurn false {
                Bob += a_card;
                isAliceTurn = true;
            } Bob += a_card Bob a_card isAliceTurn = true isAliceTurn 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)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int cards = Integer.parseInt(br.readLine());
        int[] card = new int[cards];
        String  input = br.readLine();

        for(int i = 0; i<cards-1; i++){
            card[i] = Integer.parseInt(input.substring(0,input.indexOf(" ")));
            input = input.substring(input.indexOf(" ")+1);
        }
        card[cards-1] = Integer.parseInt(input);
        Arrays.sort(card);

        int Bob = 0;
        int Alice = 0;
        boolean isAliceTurn = cards%2 == 1;

        for(int a_card : card){
            if(isAliceTurn){
                Alice += a_card;
                isAliceTurn = false;
            }
            else{
                Bob += a_card;
                isAliceTurn = true;
            }
        }
    System.out.println(Alice - Bob);
    }
} public class Main{
    public static void  main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int cards = Integer.parseInt(br.readLine());
        int[] card = new int[cards];
        String  input = br.readLine();

        for(int i = 0; i<cards-1; i++){
            card[i] = Integer.parseInt(input.substring(0,input.indexOf(" ")));
            input = input.substring(input.indexOf(" ")+1);
        }
        card[cards-1] = Integer.parseInt(input);
        Arrays.sort(card);

        int Bob = 0;
        int Alice = 0;
        boolean isAliceTurn = cards%2 == 1;

        for(int a_card : card){
            if(isAliceTurn){
                Alice += a_card;
                isAliceTurn = false;
            }
            else{
                Bob += a_card;
                isAliceTurn = true;
            }
        }
    System.out.println(Alice - Bob);
    }
} Main
import java.util.Arrays;
import java.io.*;

public class Main{
    public static void  main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int cards = Integer.parseInt(br.readLine());
        int[] card = new int[cards];
        String  input = br.readLine();

        for(int i = 0; i<cards-1; i++){
            card[i] = Integer.parseInt(input.substring(0,input.indexOf(" ")));
            input = input.substring(input.indexOf(" ")+1);
        }
        card[cards-1] = Integer.parseInt(input);
        Arrays.sort(card);

        int Bob = 0;
        int Alice = 0;
        boolean isAliceTurn = cards%2 == 1;

        for(int a_card : card){
            if(isAliceTurn){
                Alice += a_card;
                isAliceTurn = false;
            }
            else{
                Bob += a_card;
                isAliceTurn = true;
            }
        }
    System.out.println(Alice - Bob);
    }
}