import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int alicePoints = 0;
        int bobPoints = 0;
        int n = Integer.parseInt(sc.nextLine());
        String[] a = sc.nextLine().split(" ");

        Integer[] aInt = new Integer[a.length];
        for (int i = 0; i < a.length; i++) {
            aInt[i] = Integer.parseInt(a[i]);
        }
        Arrays.sort(aInt, Comparator.reverseOrder());
        for (int tursCount = 0; tursCount < n; tursCount++) {
            if (tursCount % 2 == 0) {
                alicePoints = alicePoints + aInt[tursCount];
            } else {
                bobPoints = bobPoints + aInt[tursCount];
            }
        }
        System.out.println(alicePoints - bobPoints);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int alicePoints = 0;
        int bobPoints = 0;
        int n = Integer.parseInt(sc.nextLine());
        String[] a = sc.nextLine().split(" ");

        Integer[] aInt = new Integer[a.length];
        for (int i = 0; i < a.length; i++) {
            aInt[i] = Integer.parseInt(a[i]);
        }
        Arrays.sort(aInt, Comparator.reverseOrder());
        for (int tursCount = 0; tursCount < n; tursCount++) {
            if (tursCount % 2 == 0) {
                alicePoints = alicePoints + aInt[tursCount];
            } else {
                bobPoints = bobPoints + aInt[tursCount];
            }
        }
        System.out.println(alicePoints - bobPoints);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int alicePoints = 0;
        int bobPoints = 0;
        int n = Integer.parseInt(sc.nextLine());
        String[] a = sc.nextLine().split(" ");

        Integer[] aInt = new Integer[a.length];
        for (int i = 0; i < a.length; i++) {
            aInt[i] = Integer.parseInt(a[i]);
        }
        Arrays.sort(aInt, Comparator.reverseOrder());
        for (int tursCount = 0; tursCount < n; tursCount++) {
            if (tursCount % 2 == 0) {
                alicePoints = alicePoints + aInt[tursCount];
            } else {
                bobPoints = bobPoints + aInt[tursCount];
            }
        }
        System.out.println(alicePoints - bobPoints);
    } main {
        Scanner sc = new Scanner(System.in);
        int alicePoints = 0;
        int bobPoints = 0;
        int n = Integer.parseInt(sc.nextLine());
        String[] a = sc.nextLine().split(" ");

        Integer[] aInt = new Integer[a.length];
        for (int i = 0; i < a.length; i++) {
            aInt[i] = Integer.parseInt(a[i]);
        }
        Arrays.sort(aInt, Comparator.reverseOrder());
        for (int tursCount = 0; tursCount < n; tursCount++) {
            if (tursCount % 2 == 0) {
                alicePoints = alicePoints + aInt[tursCount];
            } else {
                bobPoints = bobPoints + aInt[tursCount];
            }
        }
        System.out.println(alicePoints - bobPoints);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int alicePoints = 0; alicePoints 0 int bobPoints = 0; bobPoints 0 int n = Integer.parseInt(sc.nextLine()); n Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc String[] a = sc.nextLine().split(" "); a sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " Integer[] aInt = new Integer[a.length]; aInt new Integer[a.length] a.length a a.length for (int i = 0; i < a.length; i++) {
            aInt[i] = Integer.parseInt(a[i]);
        } int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
            aInt[i] = Integer.parseInt(a[i]);
        } {
            aInt[i] = Integer.parseInt(a[i]);
        } aInt[i] = Integer.parseInt(a[i]) aInt[i] aInt i Integer.parseInt(a[i]) Integer.parseInt Integer a[i] a i Arrays.sort(aInt, Comparator.reverseOrder()) Arrays.sort Arrays aInt Comparator.reverseOrder() Comparator.reverseOrder Comparator for (int tursCount = 0; tursCount < n; tursCount++) {
            if (tursCount % 2 == 0) {
                alicePoints = alicePoints + aInt[tursCount];
            } else {
                bobPoints = bobPoints + aInt[tursCount];
            }
        } int tursCount = 0; int tursCount = 0; tursCount 0 tursCount < n tursCount n tursCount++ tursCount++ tursCount {
            if (tursCount % 2 == 0) {
                alicePoints = alicePoints + aInt[tursCount];
            } else {
                bobPoints = bobPoints + aInt[tursCount];
            }
        } {
            if (tursCount % 2 == 0) {
                alicePoints = alicePoints + aInt[tursCount];
            } else {
                bobPoints = bobPoints + aInt[tursCount];
            }
        } if (tursCount % 2 == 0) {
                alicePoints = alicePoints + aInt[tursCount];
            } else {
                bobPoints = bobPoints + aInt[tursCount];
            } tursCount % 2 == 0 tursCount % 2 tursCount 2 0 {
                alicePoints = alicePoints + aInt[tursCount];
            } alicePoints = alicePoints + aInt[tursCount] alicePoints alicePoints + aInt[tursCount] alicePoints aInt[tursCount] aInt tursCount {
                bobPoints = bobPoints + aInt[tursCount];
            } bobPoints = bobPoints + aInt[tursCount] bobPoints bobPoints + aInt[tursCount] bobPoints aInt[tursCount] aInt tursCount System.out.println(alicePoints - bobPoints) System.out.println System.out System System.out alicePoints - bobPoints alicePoints bobPoints String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int alicePoints = 0;
        int bobPoints = 0;
        int n = Integer.parseInt(sc.nextLine());
        String[] a = sc.nextLine().split(" ");

        Integer[] aInt = new Integer[a.length];
        for (int i = 0; i < a.length; i++) {
            aInt[i] = Integer.parseInt(a[i]);
        }
        Arrays.sort(aInt, Comparator.reverseOrder());
        for (int tursCount = 0; tursCount < n; tursCount++) {
            if (tursCount % 2 == 0) {
                alicePoints = alicePoints + aInt[tursCount];
            } else {
                bobPoints = bobPoints + aInt[tursCount];
            }
        }
        System.out.println(alicePoints - bobPoints);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int alicePoints = 0;
        int bobPoints = 0;
        int n = Integer.parseInt(sc.nextLine());
        String[] a = sc.nextLine().split(" ");

        Integer[] aInt = new Integer[a.length];
        for (int i = 0; i < a.length; i++) {
            aInt[i] = Integer.parseInt(a[i]);
        }
        Arrays.sort(aInt, Comparator.reverseOrder());
        for (int tursCount = 0; tursCount < n; tursCount++) {
            if (tursCount % 2 == 0) {
                alicePoints = alicePoints + aInt[tursCount];
            } else {
                bobPoints = bobPoints + aInt[tursCount];
            }
        }
        System.out.println(alicePoints - bobPoints);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int alicePoints = 0;
        int bobPoints = 0;
        int n = Integer.parseInt(sc.nextLine());
        String[] a = sc.nextLine().split(" ");

        Integer[] aInt = new Integer[a.length];
        for (int i = 0; i < a.length; i++) {
            aInt[i] = Integer.parseInt(a[i]);
        }
        Arrays.sort(aInt, Comparator.reverseOrder());
        for (int tursCount = 0; tursCount < n; tursCount++) {
            if (tursCount % 2 == 0) {
                alicePoints = alicePoints + aInt[tursCount];
            } else {
                bobPoints = bobPoints + aInt[tursCount];
            }
        }
        System.out.println(alicePoints - bobPoints);
    }
}