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

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int[] a = new int[N];
            for (int i = 0; i < N; i++) {
                a[i] = in.nextInt();
            }

            Arrays.sort(a);

            int Alice = 0;
            int Bob = 0;
            boolean isAlice = true;
            for (int i = N - 1; i >= 0; i--, isAlice = !isAlice) {
                if (isAlice) {
                    Alice += a[i];
                } else {
                    Bob += a[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) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int[] a = new int[N];
            for (int i = 0; i < N; i++) {
                a[i] = in.nextInt();
            }

            Arrays.sort(a);

            int Alice = 0;
            int Bob = 0;
            boolean isAlice = true;
            for (int i = N - 1; i >= 0; i--, isAlice = !isAlice) {
                if (isAlice) {
                    Alice += a[i];
                } else {
                    Bob += a[i];
                }
            }

            System.out.println(Alice - Bob);
        }
    }
} Main public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int[] a = new int[N];
            for (int i = 0; i < N; i++) {
                a[i] = in.nextInt();
            }

            Arrays.sort(a);

            int Alice = 0;
            int Bob = 0;
            boolean isAlice = true;
            for (int i = N - 1; i >= 0; i--, isAlice = !isAlice) {
                if (isAlice) {
                    Alice += a[i];
                } else {
                    Bob += a[i];
                }
            }

            System.out.println(Alice - Bob);
        }
    } main {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int[] a = new int[N];
            for (int i = 0; i < N; i++) {
                a[i] = in.nextInt();
            }

            Arrays.sort(a);

            int Alice = 0;
            int Bob = 0;
            boolean isAlice = true;
            for (int i = N - 1; i >= 0; i--, isAlice = !isAlice) {
                if (isAlice) {
                    Alice += a[i];
                } else {
                    Bob += a[i];
                }
            }

            System.out.println(Alice - Bob);
        }
    } try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int[] a = new int[N];
            for (int i = 0; i < N; i++) {
                a[i] = in.nextInt();
            }

            Arrays.sort(a);

            int Alice = 0;
            int Bob = 0;
            boolean isAlice = true;
            for (int i = N - 1; i >= 0; i--, isAlice = !isAlice) {
                if (isAlice) {
                    Alice += a[i];
                } else {
                    Bob += a[i];
                }
            }

            System.out.println(Alice - Bob);
        } {
            int N = in.nextInt();
            int[] a = new int[N];
            for (int i = 0; i < N; i++) {
                a[i] = in.nextInt();
            }

            Arrays.sort(a);

            int Alice = 0;
            int Bob = 0;
            boolean isAlice = true;
            for (int i = N - 1; i >= 0; i--, isAlice = !isAlice) {
                if (isAlice) {
                    Alice += a[i];
                } else {
                    Bob += a[i];
                }
            }

            System.out.println(Alice - Bob);
        } Scanner in = new Scanner(System.in) Scanner in = new Scanner(System.in) new Scanner(System.in) int N = in.nextInt(); N in.nextInt() in.nextInt in int[] a = new int[N]; a new int[N] N for (int i = 0; i < N; i++) {
                a[i] = in.nextInt();
            } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
                a[i] = in.nextInt();
            } {
                a[i] = in.nextInt();
            } a[i] = in.nextInt() a[i] a i in.nextInt() in.nextInt in Arrays.sort(a) Arrays.sort Arrays a int Alice = 0; Alice 0 int Bob = 0; Bob 0 boolean isAlice = true; isAlice true for (int i = N - 1; i >= 0; i--, isAlice = !isAlice) {
                if (isAlice) {
                    Alice += a[i];
                } else {
                    Bob += a[i];
                }
            } int i = N - 1; int i = N - 1; i N - 1 N 1 i >= 0 i 0 i--, isAlice = !isAlice i-- i isAlice = !isAlice isAlice !isAlice isAlice {
                if (isAlice) {
                    Alice += a[i];
                } else {
                    Bob += a[i];
                }
            } {
                if (isAlice) {
                    Alice += a[i];
                } else {
                    Bob += a[i];
                }
            } if (isAlice) {
                    Alice += a[i];
                } else {
                    Bob += a[i];
                } isAlice {
                    Alice += a[i];
                } Alice += a[i] Alice a[i] a i {
                    Bob += a[i];
                } Bob += a[i] Bob a[i] a 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) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int[] a = new int[N];
            for (int i = 0; i < N; i++) {
                a[i] = in.nextInt();
            }

            Arrays.sort(a);

            int Alice = 0;
            int Bob = 0;
            boolean isAlice = true;
            for (int i = N - 1; i >= 0; i--, isAlice = !isAlice) {
                if (isAlice) {
                    Alice += a[i];
                } else {
                    Bob += a[i];
                }
            }

            System.out.println(Alice - Bob);
        }
    }
} public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int[] a = new int[N];
            for (int i = 0; i < N; i++) {
                a[i] = in.nextInt();
            }

            Arrays.sort(a);

            int Alice = 0;
            int Bob = 0;
            boolean isAlice = true;
            for (int i = N - 1; i >= 0; i--, isAlice = !isAlice) {
                if (isAlice) {
                    Alice += a[i];
                } else {
                    Bob += a[i];
                }
            }

            System.out.println(Alice - Bob);
        }
    }
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int[] a = new int[N];
            for (int i = 0; i < N; i++) {
                a[i] = in.nextInt();
            }

            Arrays.sort(a);

            int Alice = 0;
            int Bob = 0;
            boolean isAlice = true;
            for (int i = N - 1; i >= 0; i--, isAlice = !isAlice) {
                if (isAlice) {
                    Alice += a[i];
                } else {
                    Bob += a[i];
                }
            }

            System.out.println(Alice - Bob);
        }
    }
}
