import java.util.Arrays;
import java.util.Scanner;

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

    void solve(Scanner sc) {
        int n = sc.nextInt();
        int alice = 0;
        int bob = 0;
        int[] as = new int[n];
        for (int i = 0; i < n; i++) {
            as[i] = sc.nextInt();
        }
        Arrays.sort(as);
        boolean a = true;
        for (int i = n - 1; i >= 0; i--) {
            if (a) {
                alice += as[i];
                a = false;
            } else {
                bob += as[i];
                a = true;
            }
        }
        System.out.println(alice - bob);
    }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            new Main().solve(sc);
        }
    }

    void solve(Scanner sc) {
        int n = sc.nextInt();
        int alice = 0;
        int bob = 0;
        int[] as = new int[n];
        for (int i = 0; i < n; i++) {
            as[i] = sc.nextInt();
        }
        Arrays.sort(as);
        boolean a = true;
        for (int i = n - 1; i >= 0; i--) {
            if (a) {
                alice += as[i];
                a = false;
            } else {
                bob += as[i];
                a = true;
            }
        }
        System.out.println(alice - bob);
    }
} Main public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            new Main().solve(sc);
        }
    } main {
        try (Scanner sc = new Scanner(System.in);) {
            new Main().solve(sc);
        }
    } try (Scanner sc = new Scanner(System.in);) {
            new Main().solve(sc);
        } {
            new Main().solve(sc);
        } Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) new Main().solve(sc) new Main().solve new Main() sc String[] args args void solve(Scanner sc) {
        int n = sc.nextInt();
        int alice = 0;
        int bob = 0;
        int[] as = new int[n];
        for (int i = 0; i < n; i++) {
            as[i] = sc.nextInt();
        }
        Arrays.sort(as);
        boolean a = true;
        for (int i = n - 1; i >= 0; i--) {
            if (a) {
                alice += as[i];
                a = false;
            } else {
                bob += as[i];
                a = true;
            }
        }
        System.out.println(alice - bob);
    } solve {
        int n = sc.nextInt();
        int alice = 0;
        int bob = 0;
        int[] as = new int[n];
        for (int i = 0; i < n; i++) {
            as[i] = sc.nextInt();
        }
        Arrays.sort(as);
        boolean a = true;
        for (int i = n - 1; i >= 0; i--) {
            if (a) {
                alice += as[i];
                a = false;
            } else {
                bob += as[i];
                a = true;
            }
        }
        System.out.println(alice - bob);
    } int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int alice = 0; alice 0 int bob = 0; bob 0 int[] as = new int[n]; as new int[n] n for (int i = 0; i < n; i++) {
            as[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            as[i] = sc.nextInt();
        } {
            as[i] = sc.nextInt();
        } as[i] = sc.nextInt() as[i] as i sc.nextInt() sc.nextInt sc Arrays.sort(as) Arrays.sort Arrays as boolean a = true; a true for (int i = n - 1; i >= 0; i--) {
            if (a) {
                alice += as[i];
                a = false;
            } else {
                bob += as[i];
                a = true;
            }
        } int i = n - 1; int i = n - 1; i n - 1 n 1 i >= 0 i 0 i-- i-- i {
            if (a) {
                alice += as[i];
                a = false;
            } else {
                bob += as[i];
                a = true;
            }
        } {
            if (a) {
                alice += as[i];
                a = false;
            } else {
                bob += as[i];
                a = true;
            }
        } if (a) {
                alice += as[i];
                a = false;
            } else {
                bob += as[i];
                a = true;
            } a {
                alice += as[i];
                a = false;
            } alice += as[i] alice as[i] as i a = false a false {
                bob += as[i];
                a = true;
            } bob += as[i] bob as[i] as i a = true a true System.out.println(alice - bob) System.out.println System.out System System.out alice - bob alice bob Scanner sc sc public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            new Main().solve(sc);
        }
    }

    void solve(Scanner sc) {
        int n = sc.nextInt();
        int alice = 0;
        int bob = 0;
        int[] as = new int[n];
        for (int i = 0; i < n; i++) {
            as[i] = sc.nextInt();
        }
        Arrays.sort(as);
        boolean a = true;
        for (int i = n - 1; i >= 0; i--) {
            if (a) {
                alice += as[i];
                a = false;
            } else {
                bob += as[i];
                a = true;
            }
        }
        System.out.println(alice - bob);
    }
} public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            new Main().solve(sc);
        }
    }

    void solve(Scanner sc) {
        int n = sc.nextInt();
        int alice = 0;
        int bob = 0;
        int[] as = new int[n];
        for (int i = 0; i < n; i++) {
            as[i] = sc.nextInt();
        }
        Arrays.sort(as);
        boolean a = true;
        for (int i = n - 1; i >= 0; i--) {
            if (a) {
                alice += as[i];
                a = false;
            } else {
                bob += as[i];
                a = true;
            }
        }
        System.out.println(alice - bob);
    }
} Main
import java.util.Arrays;
import java.util.Scanner;

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

    void solve(Scanner sc) {
        int n = sc.nextInt();
        int alice = 0;
        int bob = 0;
        int[] as = new int[n];
        for (int i = 0; i < n; i++) {
            as[i] = sc.nextInt();
        }
        Arrays.sort(as);
        boolean a = true;
        for (int i = n - 1; i >= 0; i--) {
            if (a) {
                alice += as[i];
                a = false;
            } else {
                bob += as[i];
                a = true;
            }
        }
        System.out.println(alice - bob);
    }
}