import java.util.*;


public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);

        int cardCount = sc.nextInt();
        int[] cards = new int[cardCount];
        for (int i = 0; i < cards.length; i++) {
            cards[i] = sc.nextInt();
        }
        
        Arrays.sort(cards);
        
        int alicesPoint = 0;
        int bobsPoint = 0;
        
        for (int i = cards.length - 1; i >= 0; i -= 2) {
            alicesPoint += cards[i];
            if (i == 0) break;
            bobsPoint += cards[i - 1];
        }

        System.out.println(alicesPoint - bobsPoint);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);

        int cardCount = sc.nextInt();
        int[] cards = new int[cardCount];
        for (int i = 0; i < cards.length; i++) {
            cards[i] = sc.nextInt();
        }
        
        Arrays.sort(cards);
        
        int alicesPoint = 0;
        int bobsPoint = 0;
        
        for (int i = cards.length - 1; i >= 0; i -= 2) {
            alicesPoint += cards[i];
            if (i == 0) break;
            bobsPoint += cards[i - 1];
        }

        System.out.println(alicesPoint - bobsPoint);
    }
} Main public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);

        int cardCount = sc.nextInt();
        int[] cards = new int[cardCount];
        for (int i = 0; i < cards.length; i++) {
            cards[i] = sc.nextInt();
        }
        
        Arrays.sort(cards);
        
        int alicesPoint = 0;
        int bobsPoint = 0;
        
        for (int i = cards.length - 1; i >= 0; i -= 2) {
            alicesPoint += cards[i];
            if (i == 0) break;
            bobsPoint += cards[i - 1];
        }

        System.out.println(alicesPoint - bobsPoint);
    } main {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);

        int cardCount = sc.nextInt();
        int[] cards = new int[cardCount];
        for (int i = 0; i < cards.length; i++) {
            cards[i] = sc.nextInt();
        }
        
        Arrays.sort(cards);
        
        int alicesPoint = 0;
        int bobsPoint = 0;
        
        for (int i = cards.length - 1; i >= 0; i -= 2) {
            alicesPoint += cards[i];
            if (i == 0) break;
            bobsPoint += cards[i - 1];
        }

        System.out.println(alicesPoint - bobsPoint);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int cardCount = sc.nextInt(); cardCount sc.nextInt() sc.nextInt sc int[] cards = new int[cardCount]; cards new int[cardCount] cardCount for (int i = 0; i < cards.length; i++) {
            cards[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < cards.length i cards.length cards cards.length i++ i++ i {
            cards[i] = sc.nextInt();
        } {
            cards[i] = sc.nextInt();
        } cards[i] = sc.nextInt() cards[i] cards i sc.nextInt() sc.nextInt sc Arrays.sort(cards) Arrays.sort Arrays cards int alicesPoint = 0; alicesPoint 0 int bobsPoint = 0; bobsPoint 0 for (int i = cards.length - 1; i >= 0; i -= 2) {
            alicesPoint += cards[i];
            if (i == 0) break;
            bobsPoint += cards[i - 1];
        } int i = cards.length - 1; int i = cards.length - 1; i cards.length - 1 cards.length cards cards.length 1 i >= 0 i 0 i -= 2 i -= 2 i 2 {
            alicesPoint += cards[i];
            if (i == 0) break;
            bobsPoint += cards[i - 1];
        } {
            alicesPoint += cards[i];
            if (i == 0) break;
            bobsPoint += cards[i - 1];
        } alicesPoint += cards[i] alicesPoint cards[i] cards i if (i == 0) break; i == 0 i 0 break; bobsPoint += cards[i - 1] bobsPoint cards[i - 1] cards i - 1 i 1 System.out.println(alicesPoint - bobsPoint) System.out.println System.out System System.out alicesPoint - bobsPoint alicesPoint bobsPoint String[] args args public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);

        int cardCount = sc.nextInt();
        int[] cards = new int[cardCount];
        for (int i = 0; i < cards.length; i++) {
            cards[i] = sc.nextInt();
        }
        
        Arrays.sort(cards);
        
        int alicesPoint = 0;
        int bobsPoint = 0;
        
        for (int i = cards.length - 1; i >= 0; i -= 2) {
            alicesPoint += cards[i];
            if (i == 0) break;
            bobsPoint += cards[i - 1];
        }

        System.out.println(alicesPoint - bobsPoint);
    }
} public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);

        int cardCount = sc.nextInt();
        int[] cards = new int[cardCount];
        for (int i = 0; i < cards.length; i++) {
            cards[i] = sc.nextInt();
        }
        
        Arrays.sort(cards);
        
        int alicesPoint = 0;
        int bobsPoint = 0;
        
        for (int i = cards.length - 1; i >= 0; i -= 2) {
            alicesPoint += cards[i];
            if (i == 0) break;
            bobsPoint += cards[i - 1];
        }

        System.out.println(alicesPoint - bobsPoint);
    }
} Main
import java.util.*;


public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);

        int cardCount = sc.nextInt();
        int[] cards = new int[cardCount];
        for (int i = 0; i < cards.length; i++) {
            cards[i] = sc.nextInt();
        }
        
        Arrays.sort(cards);
        
        int alicesPoint = 0;
        int bobsPoint = 0;
        
        for (int i = cards.length - 1; i >= 0; i -= 2) {
            alicesPoint += cards[i];
            if (i == 0) break;
            bobsPoint += cards[i - 1];
        }

        System.out.println(alicesPoint - bobsPoint);
    }
}