import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        List<Integer> numlist = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            numlist.add(Integer.parseInt(sc.next()));
        }
        numlist.sort(Comparator.reverseOrder());
        int Alice = 0;
        int Bob = 0;
        for (int i = 0; i < numlist.size(); i++) {
            if (i % 2 == 0) {
                Alice += numlist.get(i).intValue();
            } else {
                Bob += numlist.get(i).intValue();
            }
        }
        System.out.println(Alice - Bob);
    }
} import java.util.ArrayList; ArrayList java.util import java.util.Comparator; Comparator java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        List<Integer> numlist = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            numlist.add(Integer.parseInt(sc.next()));
        }
        numlist.sort(Comparator.reverseOrder());
        int Alice = 0;
        int Bob = 0;
        for (int i = 0; i < numlist.size(); i++) {
            if (i % 2 == 0) {
                Alice += numlist.get(i).intValue();
            } else {
                Bob += numlist.get(i).intValue();
            }
        }
        System.out.println(Alice - Bob);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        List<Integer> numlist = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            numlist.add(Integer.parseInt(sc.next()));
        }
        numlist.sort(Comparator.reverseOrder());
        int Alice = 0;
        int Bob = 0;
        for (int i = 0; i < numlist.size(); i++) {
            if (i % 2 == 0) {
                Alice += numlist.get(i).intValue();
            } else {
                Bob += numlist.get(i).intValue();
            }
        }
        System.out.println(Alice - Bob);
    } main {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        List<Integer> numlist = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            numlist.add(Integer.parseInt(sc.next()));
        }
        numlist.sort(Comparator.reverseOrder());
        int Alice = 0;
        int Bob = 0;
        for (int i = 0; i < numlist.size(); i++) {
            if (i % 2 == 0) {
                Alice += numlist.get(i).intValue();
            } else {
                Bob += numlist.get(i).intValue();
            }
        }
        System.out.println(Alice - Bob);
    } 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 List<Integer> numlist = new ArrayList<>(); numlist new ArrayList<>() for (int i = 0; i < N; i++) {
            numlist.add(Integer.parseInt(sc.next()));
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            numlist.add(Integer.parseInt(sc.next()));
        } {
            numlist.add(Integer.parseInt(sc.next()));
        } numlist.add(Integer.parseInt(sc.next())) numlist.add numlist Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc numlist.sort(Comparator.reverseOrder()) numlist.sort numlist Comparator.reverseOrder() Comparator.reverseOrder Comparator int Alice = 0; Alice 0 int Bob = 0; Bob 0 for (int i = 0; i < numlist.size(); i++) {
            if (i % 2 == 0) {
                Alice += numlist.get(i).intValue();
            } else {
                Bob += numlist.get(i).intValue();
            }
        } int i = 0; int i = 0; i 0 i < numlist.size() i numlist.size() numlist.size numlist i++ i++ i {
            if (i % 2 == 0) {
                Alice += numlist.get(i).intValue();
            } else {
                Bob += numlist.get(i).intValue();
            }
        } {
            if (i % 2 == 0) {
                Alice += numlist.get(i).intValue();
            } else {
                Bob += numlist.get(i).intValue();
            }
        } if (i % 2 == 0) {
                Alice += numlist.get(i).intValue();
            } else {
                Bob += numlist.get(i).intValue();
            } i % 2 == 0 i % 2 i 2 0 {
                Alice += numlist.get(i).intValue();
            } Alice += numlist.get(i).intValue() Alice numlist.get(i).intValue() numlist.get(i).intValue numlist.get(i) numlist.get numlist i {
                Bob += numlist.get(i).intValue();
            } Bob += numlist.get(i).intValue() Bob numlist.get(i).intValue() numlist.get(i).intValue numlist.get(i) numlist.get numlist i System.out.println(Alice - Bob) System.out.println System.out System System.out Alice - Bob Alice Bob String[] args args
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        List<Integer> numlist = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            numlist.add(Integer.parseInt(sc.next()));
        }
        numlist.sort(Comparator.reverseOrder());
        int Alice = 0;
        int Bob = 0;
        for (int i = 0; i < numlist.size(); i++) {
            if (i % 2 == 0) {
                Alice += numlist.get(i).intValue();
            } else {
                Bob += numlist.get(i).intValue();
            }
        }
        System.out.println(Alice - Bob);
    }
}