import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
    public static PrintWriter out;

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

    private static void run() {
        out = new PrintWriter(new BufferedOutputStream(System.out));
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        // カードリスト
        ArrayList<Integer> cardlist = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            cardlist.add(Integer.parseInt(sc.next()));
        }
        // カードリストを降順ソート
        Collections.sort(cardlist);
        Collections.reverse(cardlist);
        // アリスとボブの得点
        int alice = 0;
        int bob = 0;
        boolean aliceturn = true;
        // アリス→ボブの順で交互に高いカード引く
        for (int i = 0; i < n; i++) {
            if (aliceturn) {
                alice += cardlist.get(i);
                aliceturn = false;
            } else {
                bob += cardlist.get(i);
                aliceturn = true;
            }
        }
        out.println(alice - bob);
        out.close();
        sc.close();
    }

} import java.io.BufferedOutputStream; BufferedOutputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.Scanner; Scanner java.util public class Main {
    public static PrintWriter out;

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

    private static void run() {
        out = new PrintWriter(new BufferedOutputStream(System.out));
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        // カードリスト
        ArrayList<Integer> cardlist = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            cardlist.add(Integer.parseInt(sc.next()));
        }
        // カードリストを降順ソート
        Collections.sort(cardlist);
        Collections.reverse(cardlist);
        // アリスとボブの得点
        int alice = 0;
        int bob = 0;
        boolean aliceturn = true;
        // アリス→ボブの順で交互に高いカード引く
        for (int i = 0; i < n; i++) {
            if (aliceturn) {
                alice += cardlist.get(i);
                aliceturn = false;
            } else {
                bob += cardlist.get(i);
                aliceturn = true;
            }
        }
        out.println(alice - bob);
        out.close();
        sc.close();
    }

} Main public static PrintWriter out; out public static void main(String[] args) {
        Main.run();
    } main {
        Main.run();
    } Main.run() Main.run Main String[] args args private static void run() {
        out = new PrintWriter(new BufferedOutputStream(System.out));
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        // カードリスト
        ArrayList<Integer> cardlist = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            cardlist.add(Integer.parseInt(sc.next()));
        }
        // カードリストを降順ソート
        Collections.sort(cardlist);
        Collections.reverse(cardlist);
        // アリスとボブの得点
        int alice = 0;
        int bob = 0;
        boolean aliceturn = true;
        // アリス→ボブの順で交互に高いカード引く
        for (int i = 0; i < n; i++) {
            if (aliceturn) {
                alice += cardlist.get(i);
                aliceturn = false;
            } else {
                bob += cardlist.get(i);
                aliceturn = true;
            }
        }
        out.println(alice - bob);
        out.close();
        sc.close();
    } run {
        out = new PrintWriter(new BufferedOutputStream(System.out));
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        // カードリスト
        ArrayList<Integer> cardlist = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            cardlist.add(Integer.parseInt(sc.next()));
        }
        // カードリストを降順ソート
        Collections.sort(cardlist);
        Collections.reverse(cardlist);
        // アリスとボブの得点
        int alice = 0;
        int bob = 0;
        boolean aliceturn = true;
        // アリス→ボブの順で交互に高いカード引く
        for (int i = 0; i < n; i++) {
            if (aliceturn) {
                alice += cardlist.get(i);
                aliceturn = false;
            } else {
                bob += cardlist.get(i);
                aliceturn = true;
            }
        }
        out.println(alice - bob);
        out.close();
        sc.close();
    } out = new PrintWriter(new BufferedOutputStream(System.out)) out new PrintWriter(new BufferedOutputStream(System.out)) 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 ArrayList<Integer> cardlist = new ArrayList<>(); cardlist new ArrayList<>() for (int i = 0; i < n; i++) {
            cardlist.add(Integer.parseInt(sc.next()));
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            cardlist.add(Integer.parseInt(sc.next()));
        } {
            cardlist.add(Integer.parseInt(sc.next()));
        } cardlist.add(Integer.parseInt(sc.next())) cardlist.add cardlist Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc Collections.sort(cardlist) Collections.sort Collections cardlist Collections.reverse(cardlist) Collections.reverse Collections cardlist int alice = 0; alice 0 int bob = 0; bob 0 boolean aliceturn = true; aliceturn true for (int i = 0; i < n; i++) {
            if (aliceturn) {
                alice += cardlist.get(i);
                aliceturn = false;
            } else {
                bob += cardlist.get(i);
                aliceturn = true;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            if (aliceturn) {
                alice += cardlist.get(i);
                aliceturn = false;
            } else {
                bob += cardlist.get(i);
                aliceturn = true;
            }
        } {
            if (aliceturn) {
                alice += cardlist.get(i);
                aliceturn = false;
            } else {
                bob += cardlist.get(i);
                aliceturn = true;
            }
        } if (aliceturn) {
                alice += cardlist.get(i);
                aliceturn = false;
            } else {
                bob += cardlist.get(i);
                aliceturn = true;
            } aliceturn {
                alice += cardlist.get(i);
                aliceturn = false;
            } alice += cardlist.get(i) alice cardlist.get(i) cardlist.get cardlist i aliceturn = false aliceturn false {
                bob += cardlist.get(i);
                aliceturn = true;
            } bob += cardlist.get(i) bob cardlist.get(i) cardlist.get cardlist i aliceturn = true aliceturn true out.println(alice - bob) out.println out alice - bob alice bob out.close() out.close out sc.close() sc.close sc public class Main {
    public static PrintWriter out;

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

    private static void run() {
        out = new PrintWriter(new BufferedOutputStream(System.out));
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        // カードリスト
        ArrayList<Integer> cardlist = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            cardlist.add(Integer.parseInt(sc.next()));
        }
        // カードリストを降順ソート
        Collections.sort(cardlist);
        Collections.reverse(cardlist);
        // アリスとボブの得点
        int alice = 0;
        int bob = 0;
        boolean aliceturn = true;
        // アリス→ボブの順で交互に高いカード引く
        for (int i = 0; i < n; i++) {
            if (aliceturn) {
                alice += cardlist.get(i);
                aliceturn = false;
            } else {
                bob += cardlist.get(i);
                aliceturn = true;
            }
        }
        out.println(alice - bob);
        out.close();
        sc.close();
    }

} public class Main {
    public static PrintWriter out;

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

    private static void run() {
        out = new PrintWriter(new BufferedOutputStream(System.out));
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        // カードリスト
        ArrayList<Integer> cardlist = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            cardlist.add(Integer.parseInt(sc.next()));
        }
        // カードリストを降順ソート
        Collections.sort(cardlist);
        Collections.reverse(cardlist);
        // アリスとボブの得点
        int alice = 0;
        int bob = 0;
        boolean aliceturn = true;
        // アリス→ボブの順で交互に高いカード引く
        for (int i = 0; i < n; i++) {
            if (aliceturn) {
                alice += cardlist.get(i);
                aliceturn = false;
            } else {
                bob += cardlist.get(i);
                aliceturn = true;
            }
        }
        out.println(alice - bob);
        out.close();
        sc.close();
    }

} Main
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
    public static PrintWriter out;

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

    private static void run() {
        out = new PrintWriter(new BufferedOutputStream(System.out));
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        // カードリスト
        ArrayList<Integer> cardlist = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            cardlist.add(Integer.parseInt(sc.next()));
        }
        // カードリストを降順ソート
        Collections.sort(cardlist);
        Collections.reverse(cardlist);
        // アリスとボブの得点
        int alice = 0;
        int bob = 0;
        boolean aliceturn = true;
        // アリス→ボブの順で交互に高いカード引く
        for (int i = 0; i < n; i++) {
            if (aliceturn) {
                alice += cardlist.get(i);
                aliceturn = false;
            } else {
                bob += cardlist.get(i);
                aliceturn = true;
            }
        }
        out.println(alice - bob);
        out.close();
        sc.close();
    }

}
