import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;

    Main() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        ArrayList<Integer> list = new ArrayList<Integer>(N);
        for (int i = 0; i < N; i++) {
            list.add(sc.nextInt());
        }
        Collections.sort(list,Comparator.reverseOrder());
        int a=0;
        int b = 0;
        for(int i=0;i<N;i++){
            if(i%2==0)a+=list.get(i);
            else b+=list.get(i);
        }
        System.out.println(a-b);
    }

    public static void main(String[] args) {
        new Main();
    }
} import java.math.BigInteger; BigInteger java.math import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.Collections; Collections java.util import java.util.Comparator; Comparator java.util import java.util.HashMap; HashMap java.util import java.util.HashSet; HashSet java.util import java.util.Iterator; Iterator java.util import java.util.List; List java.util import java.util.Map; Map java.util import java.util.Map.Entry; Entry java.util.Map import java.util.PriorityQueue; PriorityQueue java.util import java.util.Scanner; Scanner java.util class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;

    Main() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        ArrayList<Integer> list = new ArrayList<Integer>(N);
        for (int i = 0; i < N; i++) {
            list.add(sc.nextInt());
        }
        Collections.sort(list,Comparator.reverseOrder());
        int a=0;
        int b = 0;
        for(int i=0;i<N;i++){
            if(i%2==0)a+=list.get(i);
            else b+=list.get(i);
        }
        System.out.println(a-b);
    }

    public static void main(String[] args) {
        new Main();
    }
} Main static final int MOD = 1000000007; MOD 1000000007 static final int INF = 1 << 30; INF 1 << 30 1 30 Main() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        ArrayList<Integer> list = new ArrayList<Integer>(N);
        for (int i = 0; i < N; i++) {
            list.add(sc.nextInt());
        }
        Collections.sort(list,Comparator.reverseOrder());
        int a=0;
        int b = 0;
        for(int i=0;i<N;i++){
            if(i%2==0)a+=list.get(i);
            else b+=list.get(i);
        }
        System.out.println(a-b);
    } Main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        ArrayList<Integer> list = new ArrayList<Integer>(N);
        for (int i = 0; i < N; i++) {
            list.add(sc.nextInt());
        }
        Collections.sort(list,Comparator.reverseOrder());
        int a=0;
        int b = 0;
        for(int i=0;i<N;i++){
            if(i%2==0)a+=list.get(i);
            else b+=list.get(i);
        }
        System.out.println(a-b);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc ArrayList<Integer> list = new ArrayList<Integer>(N); list new ArrayList<Integer>(N) for (int i = 0; i < N; i++) {
            list.add(sc.nextInt());
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            list.add(sc.nextInt());
        } {
            list.add(sc.nextInt());
        } list.add(sc.nextInt()) list.add list sc.nextInt() sc.nextInt sc Collections.sort(list,Comparator.reverseOrder()) Collections.sort Collections list Comparator.reverseOrder() Comparator.reverseOrder Comparator int a=0; a 0 int b = 0; b 0 for(int i=0;i<N;i++){
            if(i%2==0)a+=list.get(i);
            else b+=list.get(i);
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            if(i%2==0)a+=list.get(i);
            else b+=list.get(i);
        } {
            if(i%2==0)a+=list.get(i);
            else b+=list.get(i);
        } if(i%2==0)a+=list.get(i);
            else b+=list.get(i); i%2==0 i%2 i 2 0 a+=list.get(i) a list.get(i) list.get list i b+=list.get(i) b list.get(i) list.get list i System.out.println(a-b) System.out.println System.out System System.out a-b a b public static void main(String[] args) {
        new Main();
    } main {
        new Main();
    } new Main() String[] args args
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;

    Main() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        ArrayList<Integer> list = new ArrayList<Integer>(N);
        for (int i = 0; i < N; i++) {
            list.add(sc.nextInt());
        }
        Collections.sort(list,Comparator.reverseOrder());
        int a=0;
        int b = 0;
        for(int i=0;i<N;i++){
            if(i%2==0)a+=list.get(i);
            else b+=list.get(i);
        }
        System.out.println(a-b);
    }

    public static void main(String[] args) {
        new Main();
    }
}
