import java.util.Scanner;
import java.util.Arrays;
import java.util.Collections;
public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a   = scan.nextInt();
        Integer b[] = new Integer[a];
        int alicesum = 0;
        int bobsum   = 0;

        for (int i = 0; i < a; i++) {
            b[i] = scan.nextInt();
        }

        Arrays.sort(b, Collections.reverseOrder());

        for (int i = 0; i < a; i = i+2) {
        	alicesum = alicesum + b[i];
        }

        for (int i = 1; i < a; i = i+2) {
        	bobsum = bobsum + b[i];
        }

        System.out.println(alicesum-bobsum);

    }
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util import java.util.Collections; Collections java.util public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a   = scan.nextInt();
        Integer b[] = new Integer[a];
        int alicesum = 0;
        int bobsum   = 0;

        for (int i = 0; i < a; i++) {
            b[i] = scan.nextInt();
        }

        Arrays.sort(b, Collections.reverseOrder());

        for (int i = 0; i < a; i = i+2) {
        	alicesum = alicesum + b[i];
        }

        for (int i = 1; i < a; i = i+2) {
        	bobsum = bobsum + b[i];
        }

        System.out.println(alicesum-bobsum);

    }
} Main public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a   = scan.nextInt();
        Integer b[] = new Integer[a];
        int alicesum = 0;
        int bobsum   = 0;

        for (int i = 0; i < a; i++) {
            b[i] = scan.nextInt();
        }

        Arrays.sort(b, Collections.reverseOrder());

        for (int i = 0; i < a; i = i+2) {
        	alicesum = alicesum + b[i];
        }

        for (int i = 1; i < a; i = i+2) {
        	bobsum = bobsum + b[i];
        }

        System.out.println(alicesum-bobsum);

    } main {
        Scanner scan = new Scanner(System.in);
        int a   = scan.nextInt();
        Integer b[] = new Integer[a];
        int alicesum = 0;
        int bobsum   = 0;

        for (int i = 0; i < a; i++) {
            b[i] = scan.nextInt();
        }

        Arrays.sort(b, Collections.reverseOrder());

        for (int i = 0; i < a; i = i+2) {
        	alicesum = alicesum + b[i];
        }

        for (int i = 1; i < a; i = i+2) {
        	bobsum = bobsum + b[i];
        }

        System.out.println(alicesum-bobsum);

    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int a   = scan.nextInt(); a scan.nextInt() scan.nextInt scan Integer b[] = new Integer[a]; b new Integer[a] a int alicesum = 0; alicesum 0 int bobsum   = 0; bobsum 0 for (int i = 0; i < a; i++) {
            b[i] = scan.nextInt();
        } int i = 0; int i = 0; i 0 i < a i a i++ i++ i {
            b[i] = scan.nextInt();
        } {
            b[i] = scan.nextInt();
        } b[i] = scan.nextInt() b[i] b i scan.nextInt() scan.nextInt scan Arrays.sort(b, Collections.reverseOrder()) Arrays.sort Arrays b Collections.reverseOrder() Collections.reverseOrder Collections for (int i = 0; i < a; i = i+2) {
        	alicesum = alicesum + b[i];
        } int i = 0; int i = 0; i 0 i < a i a i = i+2 i = i+2 i i+2 i 2 {
        	alicesum = alicesum + b[i];
        } {
        	alicesum = alicesum + b[i];
        } alicesum = alicesum + b[i] alicesum alicesum + b[i] alicesum b[i] b i for (int i = 1; i < a; i = i+2) {
        	bobsum = bobsum + b[i];
        } int i = 1; int i = 1; i 1 i < a i a i = i+2 i = i+2 i i+2 i 2 {
        	bobsum = bobsum + b[i];
        } {
        	bobsum = bobsum + b[i];
        } bobsum = bobsum + b[i] bobsum bobsum + b[i] bobsum b[i] b i System.out.println(alicesum-bobsum) System.out.println System.out System System.out alicesum-bobsum alicesum bobsum String[] args args public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a   = scan.nextInt();
        Integer b[] = new Integer[a];
        int alicesum = 0;
        int bobsum   = 0;

        for (int i = 0; i < a; i++) {
            b[i] = scan.nextInt();
        }

        Arrays.sort(b, Collections.reverseOrder());

        for (int i = 0; i < a; i = i+2) {
        	alicesum = alicesum + b[i];
        }

        for (int i = 1; i < a; i = i+2) {
        	bobsum = bobsum + b[i];
        }

        System.out.println(alicesum-bobsum);

    }
} public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a   = scan.nextInt();
        Integer b[] = new Integer[a];
        int alicesum = 0;
        int bobsum   = 0;

        for (int i = 0; i < a; i++) {
            b[i] = scan.nextInt();
        }

        Arrays.sort(b, Collections.reverseOrder());

        for (int i = 0; i < a; i = i+2) {
        	alicesum = alicesum + b[i];
        }

        for (int i = 1; i < a; i = i+2) {
        	bobsum = bobsum + b[i];
        }

        System.out.println(alicesum-bobsum);

    }
} Main
import java.util.Scanner;
import java.util.Arrays;
import java.util.Collections;
public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a   = scan.nextInt();
        Integer b[] = new Integer[a];
        int alicesum = 0;
        int bobsum   = 0;

        for (int i = 0; i < a; i++) {
            b[i] = scan.nextInt();
        }

        Arrays.sort(b, Collections.reverseOrder());

        for (int i = 0; i < a; i = i+2) {
        	alicesum = alicesum + b[i];
        }

        for (int i = 1; i < a; i = i+2) {
        	bobsum = bobsum + b[i];
        }

        System.out.println(alicesum-bobsum);

    }
}
