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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int a[] = new int[n];
        for(int i = 0; i < n; i++){
            a[i] = Integer.parseInt(sc.next());
        }

        Sort(a);

        int alice = 0;
        int bob = 0;

        for (int i = 0; i < n; i++) {
            if(i % 2 == 0){
                alice += a[i];
            }else{
                bob += a[i];
            }
        }

        System.out.println(alice - bob);

        sc.close();
    }

    static void Sort(int[] array) {
        for (int i = 0; i < array.length - 1; i++) {
            for (int j = array.length - 1; j > i; j--) {
                if (array[i] < array[j]) {
                    int tem = array[i];
                    array[i] = array[j];
                    array[j] = tem;
                }
            }
        }
    }
} import java.util.*; util.* java import java.io.*; io.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int a[] = new int[n];
        for(int i = 0; i < n; i++){
            a[i] = Integer.parseInt(sc.next());
        }

        Sort(a);

        int alice = 0;
        int bob = 0;

        for (int i = 0; i < n; i++) {
            if(i % 2 == 0){
                alice += a[i];
            }else{
                bob += a[i];
            }
        }

        System.out.println(alice - bob);

        sc.close();
    }

    static void Sort(int[] array) {
        for (int i = 0; i < array.length - 1; i++) {
            for (int j = array.length - 1; j > i; j--) {
                if (array[i] < array[j]) {
                    int tem = array[i];
                    array[i] = array[j];
                    array[j] = tem;
                }
            }
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int a[] = new int[n];
        for(int i = 0; i < n; i++){
            a[i] = Integer.parseInt(sc.next());
        }

        Sort(a);

        int alice = 0;
        int bob = 0;

        for (int i = 0; i < n; i++) {
            if(i % 2 == 0){
                alice += a[i];
            }else{
                bob += a[i];
            }
        }

        System.out.println(alice - bob);

        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int a[] = new int[n];
        for(int i = 0; i < n; i++){
            a[i] = Integer.parseInt(sc.next());
        }

        Sort(a);

        int alice = 0;
        int bob = 0;

        for (int i = 0; i < n; i++) {
            if(i % 2 == 0){
                alice += a[i];
            }else{
                bob += a[i];
            }
        }

        System.out.println(alice - bob);

        sc.close();
    } 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 int a[] = new int[n]; a new int[n] n for(int i = 0; i < n; i++){
            a[i] = Integer.parseInt(sc.next());
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            a[i] = Integer.parseInt(sc.next());
        } {
            a[i] = Integer.parseInt(sc.next());
        } a[i] = Integer.parseInt(sc.next()) a[i] a i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc Sort(a) Sort a int alice = 0; alice 0 int bob = 0; bob 0 for (int i = 0; i < n; i++) {
            if(i % 2 == 0){
                alice += a[i];
            }else{
                bob += a[i];
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            if(i % 2 == 0){
                alice += a[i];
            }else{
                bob += a[i];
            }
        } {
            if(i % 2 == 0){
                alice += a[i];
            }else{
                bob += a[i];
            }
        } if(i % 2 == 0){
                alice += a[i];
            }else{
                bob += a[i];
            } i % 2 == 0 i % 2 i 2 0 {
                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 sc.close() sc.close sc String[] args args static void Sort(int[] array) {
        for (int i = 0; i < array.length - 1; i++) {
            for (int j = array.length - 1; j > i; j--) {
                if (array[i] < array[j]) {
                    int tem = array[i];
                    array[i] = array[j];
                    array[j] = tem;
                }
            }
        }
    } Sort {
        for (int i = 0; i < array.length - 1; i++) {
            for (int j = array.length - 1; j > i; j--) {
                if (array[i] < array[j]) {
                    int tem = array[i];
                    array[i] = array[j];
                    array[j] = tem;
                }
            }
        }
    } for (int i = 0; i < array.length - 1; i++) {
            for (int j = array.length - 1; j > i; j--) {
                if (array[i] < array[j]) {
                    int tem = array[i];
                    array[i] = array[j];
                    array[j] = tem;
                }
            }
        } int i = 0; int i = 0; i 0 i < array.length - 1 i array.length - 1 array.length array array.length 1 i++ i++ i {
            for (int j = array.length - 1; j > i; j--) {
                if (array[i] < array[j]) {
                    int tem = array[i];
                    array[i] = array[j];
                    array[j] = tem;
                }
            }
        } {
            for (int j = array.length - 1; j > i; j--) {
                if (array[i] < array[j]) {
                    int tem = array[i];
                    array[i] = array[j];
                    array[j] = tem;
                }
            }
        } for (int j = array.length - 1; j > i; j--) {
                if (array[i] < array[j]) {
                    int tem = array[i];
                    array[i] = array[j];
                    array[j] = tem;
                }
            } int j = array.length - 1; int j = array.length - 1; j array.length - 1 array.length array array.length 1 j > i j i j-- j-- j {
                if (array[i] < array[j]) {
                    int tem = array[i];
                    array[i] = array[j];
                    array[j] = tem;
                }
            } {
                if (array[i] < array[j]) {
                    int tem = array[i];
                    array[i] = array[j];
                    array[j] = tem;
                }
            } if (array[i] < array[j]) {
                    int tem = array[i];
                    array[i] = array[j];
                    array[j] = tem;
                } array[i] < array[j] array[i] array i array[j] array j {
                    int tem = array[i];
                    array[i] = array[j];
                    array[j] = tem;
                } int tem = array[i]; tem array[i] array i array[i] = array[j] array[i] array i array[j] array j array[j] = tem array[j] array j tem int[] array array public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int a[] = new int[n];
        for(int i = 0; i < n; i++){
            a[i] = Integer.parseInt(sc.next());
        }

        Sort(a);

        int alice = 0;
        int bob = 0;

        for (int i = 0; i < n; i++) {
            if(i % 2 == 0){
                alice += a[i];
            }else{
                bob += a[i];
            }
        }

        System.out.println(alice - bob);

        sc.close();
    }

    static void Sort(int[] array) {
        for (int i = 0; i < array.length - 1; i++) {
            for (int j = array.length - 1; j > i; j--) {
                if (array[i] < array[j]) {
                    int tem = array[i];
                    array[i] = array[j];
                    array[j] = tem;
                }
            }
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int a[] = new int[n];
        for(int i = 0; i < n; i++){
            a[i] = Integer.parseInt(sc.next());
        }

        Sort(a);

        int alice = 0;
        int bob = 0;

        for (int i = 0; i < n; i++) {
            if(i % 2 == 0){
                alice += a[i];
            }else{
                bob += a[i];
            }
        }

        System.out.println(alice - bob);

        sc.close();
    }

    static void Sort(int[] array) {
        for (int i = 0; i < array.length - 1; i++) {
            for (int j = array.length - 1; j > i; j--) {
                if (array[i] < array[j]) {
                    int tem = array[i];
                    array[i] = array[j];
                    array[j] = tem;
                }
            }
        }
    }
} Main
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int a[] = new int[n];
        for(int i = 0; i < n; i++){
            a[i] = Integer.parseInt(sc.next());
        }

        Sort(a);

        int alice = 0;
        int bob = 0;

        for (int i = 0; i < n; i++) {
            if(i % 2 == 0){
                alice += a[i];
            }else{
                bob += a[i];
            }
        }

        System.out.println(alice - bob);

        sc.close();
    }

    static void Sort(int[] array) {
        for (int i = 0; i < array.length - 1; i++) {
            for (int j = array.length - 1; j > i; j--) {
                if (array[i] < array[j]) {
                    int tem = array[i];
                    array[i] = array[j];
                    array[j] = tem;
                }
            }
        }
    }
}