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

public class Main {
    public static void main(String[] args) {
        int N, cnt = 0;
        Scanner scanner = new Scanner(System.in);

        List<Integer> numbers = new ArrayList<>();
        N = Integer.parseInt(scanner.next());

        for (int i = 0; i < N; i++) {
            numbers.add(Integer.parseInt(scanner.next()));
        }

        numbers.sort(Comparator.reverseOrder());

        for (int i = 0; i < numbers.size(); i++) {
            if (i % 2 == 0) {
                cnt += numbers.get(i);
            } else {
                cnt -= numbers.get(i);
            }
        }

        System.out.println(cnt);
    }
} 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 public class Main {
    public static void main(String[] args) {
        int N, cnt = 0;
        Scanner scanner = new Scanner(System.in);

        List<Integer> numbers = new ArrayList<>();
        N = Integer.parseInt(scanner.next());

        for (int i = 0; i < N; i++) {
            numbers.add(Integer.parseInt(scanner.next()));
        }

        numbers.sort(Comparator.reverseOrder());

        for (int i = 0; i < numbers.size(); i++) {
            if (i % 2 == 0) {
                cnt += numbers.get(i);
            } else {
                cnt -= numbers.get(i);
            }
        }

        System.out.println(cnt);
    }
} Main public static void main(String[] args) {
        int N, cnt = 0;
        Scanner scanner = new Scanner(System.in);

        List<Integer> numbers = new ArrayList<>();
        N = Integer.parseInt(scanner.next());

        for (int i = 0; i < N; i++) {
            numbers.add(Integer.parseInt(scanner.next()));
        }

        numbers.sort(Comparator.reverseOrder());

        for (int i = 0; i < numbers.size(); i++) {
            if (i % 2 == 0) {
                cnt += numbers.get(i);
            } else {
                cnt -= numbers.get(i);
            }
        }

        System.out.println(cnt);
    } main {
        int N, cnt = 0;
        Scanner scanner = new Scanner(System.in);

        List<Integer> numbers = new ArrayList<>();
        N = Integer.parseInt(scanner.next());

        for (int i = 0; i < N; i++) {
            numbers.add(Integer.parseInt(scanner.next()));
        }

        numbers.sort(Comparator.reverseOrder());

        for (int i = 0; i < numbers.size(); i++) {
            if (i % 2 == 0) {
                cnt += numbers.get(i);
            } else {
                cnt -= numbers.get(i);
            }
        }

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

        List<Integer> numbers = new ArrayList<>();
        N = Integer.parseInt(scanner.next());

        for (int i = 0; i < N; i++) {
            numbers.add(Integer.parseInt(scanner.next()));
        }

        numbers.sort(Comparator.reverseOrder());

        for (int i = 0; i < numbers.size(); i++) {
            if (i % 2 == 0) {
                cnt += numbers.get(i);
            } else {
                cnt -= numbers.get(i);
            }
        }

        System.out.println(cnt);
    }
} public class Main {
    public static void main(String[] args) {
        int N, cnt = 0;
        Scanner scanner = new Scanner(System.in);

        List<Integer> numbers = new ArrayList<>();
        N = Integer.parseInt(scanner.next());

        for (int i = 0; i < N; i++) {
            numbers.add(Integer.parseInt(scanner.next()));
        }

        numbers.sort(Comparator.reverseOrder());

        for (int i = 0; i < numbers.size(); i++) {
            if (i % 2 == 0) {
                cnt += numbers.get(i);
            } else {
                cnt -= numbers.get(i);
            }
        }

        System.out.println(cnt);
    }
} Main
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        int N, cnt = 0;
        Scanner scanner = new Scanner(System.in);

        List<Integer> numbers = new ArrayList<>();
        N = Integer.parseInt(scanner.next());

        for (int i = 0; i < N; i++) {
            numbers.add(Integer.parseInt(scanner.next()));
        }

        numbers.sort(Comparator.reverseOrder());

        for (int i = 0; i < numbers.size(); i++) {
            if (i % 2 == 0) {
                cnt += numbers.get(i);
            } else {
                cnt -= numbers.get(i);
            }
        }

        System.out.println(cnt);
    }
}
