import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] cards = new int[100];
        int alice = 0;
        int bob = 0;
        for (int i = 0; i < n; i++) {
            cards[i] = sc.nextInt();
        }
        Arrays.sort(cards);
        for (int i = 0; i < cards.length; i++) {
            if(i % 2 == 0) {
                bob += cards[i];
            } else {
                alice += cards[i];
            }
        }
        System.out.println(alice - bob);
    }
} import java.util.Arrays; Arrays java.util 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[] cards = new int[100];
        int alice = 0;
        int bob = 0;
        for (int i = 0; i < n; i++) {
            cards[i] = sc.nextInt();
        }
        Arrays.sort(cards);
        for (int i = 0; i < cards.length; i++) {
            if(i % 2 == 0) {
                bob += cards[i];
            } else {
                alice += cards[i];
            }
        }
        System.out.println(alice - bob);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] cards = new int[100];
        int alice = 0;
        int bob = 0;
        for (int i = 0; i < n; i++) {
            cards[i] = sc.nextInt();
        }
        Arrays.sort(cards);
        for (int i = 0; i < cards.length; i++) {
            if(i % 2 == 0) {
                bob += cards[i];
            } else {
                alice += cards[i];
            }
        }
        System.out.println(alice - bob);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] cards = new int[100];
        int alice = 0;
        int bob = 0;
        for (int i = 0; i < n; i++) {
            cards[i] = sc.nextInt();
        }
        Arrays.sort(cards);
        for (int i = 0; i < cards.length; i++) {
            if(i % 2 == 0) {
                bob += cards[i];
            } else {
                alice += cards[i];
            }
        }
        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[] cards = new int[100]; cards new int[100] 100 int alice = 0; alice 0 int bob = 0; bob 0 for (int i = 0; i < n; i++) {
            cards[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n 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 for (int i = 0; i < cards.length; i++) {
            if(i % 2 == 0) {
                bob += cards[i];
            } else {
                alice += cards[i];
            }
        } int i = 0; int i = 0; i 0 i < cards.length i cards.length cards cards.length i++ i++ i {
            if(i % 2 == 0) {
                bob += cards[i];
            } else {
                alice += cards[i];
            }
        } {
            if(i % 2 == 0) {
                bob += cards[i];
            } else {
                alice += cards[i];
            }
        } if(i % 2 == 0) {
                bob += cards[i];
            } else {
                alice += cards[i];
            } i % 2 == 0 i % 2 i 2 0 {
                bob += cards[i];
            } bob += cards[i] bob cards[i] cards i {
                alice += cards[i];
            } alice += cards[i] alice 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) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] cards = new int[100];
        int alice = 0;
        int bob = 0;
        for (int i = 0; i < n; i++) {
            cards[i] = sc.nextInt();
        }
        Arrays.sort(cards);
        for (int i = 0; i < cards.length; i++) {
            if(i % 2 == 0) {
                bob += cards[i];
            } else {
                alice += cards[i];
            }
        }
        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[] cards = new int[100];
        int alice = 0;
        int bob = 0;
        for (int i = 0; i < n; i++) {
            cards[i] = sc.nextInt();
        }
        Arrays.sort(cards);
        for (int i = 0; i < cards.length; i++) {
            if(i % 2 == 0) {
                bob += cards[i];
            } else {
                alice += cards[i];
            }
        }
        System.out.println(alice - bob);
    }
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] cards = new int[100];
        int alice = 0;
        int bob = 0;
        for (int i = 0; i < n; i++) {
            cards[i] = sc.nextInt();
        }
        Arrays.sort(cards);
        for (int i = 0; i < cards.length; i++) {
            if(i % 2 == 0) {
                bob += cards[i];
            } else {
                alice += cards[i];
            }
        }
        System.out.println(alice - bob);
    }
}
