import java.nio.Buffer;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int sumA = 0;
        int sumB = 0;
        List<Integer> nums = new LinkedList<>();

        for(int i=0; i<n; i++){
            nums.add(sc.nextInt());
        }

        for(int i=1; i<n+1; i++){
            if(i%2 != 0){
                sumA += Collections.max(nums);
                nums.remove(nums.indexOf(Collections.max(nums)));
            }else{
                sumB += Collections.max(nums);
                nums.remove(nums.indexOf(Collections.max(nums)));
            }
        }

        System.out.println(sumA - sumB);


    }
} import java.nio.Buffer; Buffer java.nio import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int sumA = 0;
        int sumB = 0;
        List<Integer> nums = new LinkedList<>();

        for(int i=0; i<n; i++){
            nums.add(sc.nextInt());
        }

        for(int i=1; i<n+1; i++){
            if(i%2 != 0){
                sumA += Collections.max(nums);
                nums.remove(nums.indexOf(Collections.max(nums)));
            }else{
                sumB += Collections.max(nums);
                nums.remove(nums.indexOf(Collections.max(nums)));
            }
        }

        System.out.println(sumA - sumB);


    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int sumA = 0;
        int sumB = 0;
        List<Integer> nums = new LinkedList<>();

        for(int i=0; i<n; i++){
            nums.add(sc.nextInt());
        }

        for(int i=1; i<n+1; i++){
            if(i%2 != 0){
                sumA += Collections.max(nums);
                nums.remove(nums.indexOf(Collections.max(nums)));
            }else{
                sumB += Collections.max(nums);
                nums.remove(nums.indexOf(Collections.max(nums)));
            }
        }

        System.out.println(sumA - sumB);


    } main {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int sumA = 0;
        int sumB = 0;
        List<Integer> nums = new LinkedList<>();

        for(int i=0; i<n; i++){
            nums.add(sc.nextInt());
        }

        for(int i=1; i<n+1; i++){
            if(i%2 != 0){
                sumA += Collections.max(nums);
                nums.remove(nums.indexOf(Collections.max(nums)));
            }else{
                sumB += Collections.max(nums);
                nums.remove(nums.indexOf(Collections.max(nums)));
            }
        }

        System.out.println(sumA - sumB);


    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int sumA = 0; sumA 0 int sumB = 0; sumB 0 List<Integer> nums = new LinkedList<>(); nums new LinkedList<>() for(int i=0; i<n; i++){
            nums.add(sc.nextInt());
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            nums.add(sc.nextInt());
        } {
            nums.add(sc.nextInt());
        } nums.add(sc.nextInt()) nums.add nums sc.nextInt() sc.nextInt sc for(int i=1; i<n+1; i++){
            if(i%2 != 0){
                sumA += Collections.max(nums);
                nums.remove(nums.indexOf(Collections.max(nums)));
            }else{
                sumB += Collections.max(nums);
                nums.remove(nums.indexOf(Collections.max(nums)));
            }
        } int i=1; int i=1; i 1 i<n+1 i n+1 n 1 i++ i++ i {
            if(i%2 != 0){
                sumA += Collections.max(nums);
                nums.remove(nums.indexOf(Collections.max(nums)));
            }else{
                sumB += Collections.max(nums);
                nums.remove(nums.indexOf(Collections.max(nums)));
            }
        } {
            if(i%2 != 0){
                sumA += Collections.max(nums);
                nums.remove(nums.indexOf(Collections.max(nums)));
            }else{
                sumB += Collections.max(nums);
                nums.remove(nums.indexOf(Collections.max(nums)));
            }
        } if(i%2 != 0){
                sumA += Collections.max(nums);
                nums.remove(nums.indexOf(Collections.max(nums)));
            }else{
                sumB += Collections.max(nums);
                nums.remove(nums.indexOf(Collections.max(nums)));
            } i%2 != 0 i%2 i 2 0 {
                sumA += Collections.max(nums);
                nums.remove(nums.indexOf(Collections.max(nums)));
            } sumA += Collections.max(nums) sumA Collections.max(nums) Collections.max Collections nums nums.remove(nums.indexOf(Collections.max(nums))) nums.remove nums nums.indexOf(Collections.max(nums)) nums.indexOf nums Collections.max(nums) Collections.max Collections nums {
                sumB += Collections.max(nums);
                nums.remove(nums.indexOf(Collections.max(nums)));
            } sumB += Collections.max(nums) sumB Collections.max(nums) Collections.max Collections nums nums.remove(nums.indexOf(Collections.max(nums))) nums.remove nums nums.indexOf(Collections.max(nums)) nums.indexOf nums Collections.max(nums) Collections.max Collections nums System.out.println(sumA - sumB) System.out.println System.out System System.out sumA - sumB sumA sumB String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int sumA = 0;
        int sumB = 0;
        List<Integer> nums = new LinkedList<>();

        for(int i=0; i<n; i++){
            nums.add(sc.nextInt());
        }

        for(int i=1; i<n+1; i++){
            if(i%2 != 0){
                sumA += Collections.max(nums);
                nums.remove(nums.indexOf(Collections.max(nums)));
            }else{
                sumB += Collections.max(nums);
                nums.remove(nums.indexOf(Collections.max(nums)));
            }
        }

        System.out.println(sumA - sumB);


    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int sumA = 0;
        int sumB = 0;
        List<Integer> nums = new LinkedList<>();

        for(int i=0; i<n; i++){
            nums.add(sc.nextInt());
        }

        for(int i=1; i<n+1; i++){
            if(i%2 != 0){
                sumA += Collections.max(nums);
                nums.remove(nums.indexOf(Collections.max(nums)));
            }else{
                sumB += Collections.max(nums);
                nums.remove(nums.indexOf(Collections.max(nums)));
            }
        }

        System.out.println(sumA - sumB);


    }
} Main
import java.nio.Buffer;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int sumA = 0;
        int sumB = 0;
        List<Integer> nums = new LinkedList<>();

        for(int i=0; i<n; i++){
            nums.add(sc.nextInt());
        }

        for(int i=1; i<n+1; i++){
            if(i%2 != 0){
                sumA += Collections.max(nums);
                nums.remove(nums.indexOf(Collections.max(nums)));
            }else{
                sumB += Collections.max(nums);
                nums.remove(nums.indexOf(Collections.max(nums)));
            }
        }

        System.out.println(sumA - sumB);


    }
}
