import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Integer[] cards = new Integer[n];
        for (int i = 0; i < n; i++) {
            cards[i] = Integer.parseInt(sc.next());
        }
        Arrays.sort(cards, Comparator.reverseOrder());
        int alice = 0;
        int bob = 0;
        for (int i = 0; i < n; i++) {
            if (1 == 0 || i % 2 == 0) {
                alice += cards[i];
            } else {
                bob += cards[i];
            }
        }
        System.out.println(alice - bob);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Integer[] cards = new Integer[n];
        for (int i = 0; i < n; i++) {
            cards[i] = Integer.parseInt(sc.next());
        }
        Arrays.sort(cards, Comparator.reverseOrder());
        int alice = 0;
        int bob = 0;
        for (int i = 0; i < n; i++) {
            if (1 == 0 || i % 2 == 0) {
                alice += cards[i];
            } else {
                bob += cards[i];
            }
        }
        System.out.println(alice - bob);
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Integer[] cards = new Integer[n];
        for (int i = 0; i < n; i++) {
            cards[i] = Integer.parseInt(sc.next());
        }
        Arrays.sort(cards, Comparator.reverseOrder());
        int alice = 0;
        int bob = 0;
        for (int i = 0; i < n; i++) {
            if (1 == 0 || i % 2 == 0) {
                alice += cards[i];
            } else {
                bob += cards[i];
            }
        }
        System.out.println(alice - bob);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Integer[] cards = new Integer[n];
        for (int i = 0; i < n; i++) {
            cards[i] = Integer.parseInt(sc.next());
        }
        Arrays.sort(cards, Comparator.reverseOrder());
        int alice = 0;
        int bob = 0;
        for (int i = 0; i < n; i++) {
            if (1 == 0 || i % 2 == 0) {
                alice += cards[i];
            } else {
                bob += cards[i];
            }
        }
        System.out.println(alice - bob);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc Integer[] cards = new Integer[n]; cards new Integer[n] n for (int i = 0; i < n; i++) {
            cards[i] = Integer.parseInt(sc.next());
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            cards[i] = Integer.parseInt(sc.next());
        } {
            cards[i] = Integer.parseInt(sc.next());
        } cards[i] = Integer.parseInt(sc.next()) cards[i] cards i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc Arrays.sort(cards, Comparator.reverseOrder()) Arrays.sort Arrays cards Comparator.reverseOrder() Comparator.reverseOrder Comparator int alice = 0; alice 0 int bob = 0; bob 0 for (int i = 0; i < n; i++) {
            if (1 == 0 || i % 2 == 0) {
                alice += cards[i];
            } else {
                bob += cards[i];
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            if (1 == 0 || i % 2 == 0) {
                alice += cards[i];
            } else {
                bob += cards[i];
            }
        } {
            if (1 == 0 || i % 2 == 0) {
                alice += cards[i];
            } else {
                bob += cards[i];
            }
        } if (1 == 0 || i % 2 == 0) {
                alice += cards[i];
            } else {
                bob += cards[i];
            } 1 == 0 || i % 2 == 0 1 == 0 1 0 i % 2 == 0 i % 2 i 2 0 {
                alice += cards[i];
            } alice += cards[i] alice cards[i] cards i {
                bob += cards[i];
            } bob += cards[i] bob cards[i] cards i 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 Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Integer[] cards = new Integer[n];
        for (int i = 0; i < n; i++) {
            cards[i] = Integer.parseInt(sc.next());
        }
        Arrays.sort(cards, Comparator.reverseOrder());
        int alice = 0;
        int bob = 0;
        for (int i = 0; i < n; i++) {
            if (1 == 0 || i % 2 == 0) {
                alice += cards[i];
            } else {
                bob += cards[i];
            }
        }
        System.out.println(alice - bob);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Integer[] cards = new Integer[n];
        for (int i = 0; i < n; i++) {
            cards[i] = Integer.parseInt(sc.next());
        }
        Arrays.sort(cards, Comparator.reverseOrder());
        int alice = 0;
        int bob = 0;
        for (int i = 0; i < n; i++) {
            if (1 == 0 || i % 2 == 0) {
                alice += cards[i];
            } else {
                bob += cards[i];
            }
        }
        System.out.println(alice - bob);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Integer[] cards = new Integer[n];
        for (int i = 0; i < n; i++) {
            cards[i] = Integer.parseInt(sc.next());
        }
        Arrays.sort(cards, Comparator.reverseOrder());
        int alice = 0;
        int bob = 0;
        for (int i = 0; i < n; i++) {
            if (1 == 0 || i % 2 == 0) {
                alice += cards[i];
            } else {
                bob += cards[i];
            }
        }
        System.out.println(alice - bob);
    }
}
