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

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

        int N = Integer.parseInt(sc.next());
        List<Integer> aList = new ArrayList<Integer>();
        for (int i=0; i<N; i++) {
            aList.add(Integer.parseInt(sc.next()));
        }

        int AorB = 0;
        int sumA = 0;
        int sumB = 0;
        int aLength = N;

        for (int i=0; i<N; i++) {
            int flag = 0;
            for (int j = 0; j<aLength; j++) {
                if (aList.get(j) > flag) {
                    flag = aList.get(j);
                }
            }
            aList.remove(aList.indexOf(flag));
            aLength -= 1;
            if (AorB == 0) {
                AorB = 1;
                sumA += flag;
            } else {
                AorB = 0;
                sumB += flag;
            }
        }

        System.out.println(sumA - sumB);
    }
} import java.util.ArrayList; ArrayList 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) {
        Scanner sc = new Scanner(System.in);

        int N = Integer.parseInt(sc.next());
        List<Integer> aList = new ArrayList<Integer>();
        for (int i=0; i<N; i++) {
            aList.add(Integer.parseInt(sc.next()));
        }

        int AorB = 0;
        int sumA = 0;
        int sumB = 0;
        int aLength = N;

        for (int i=0; i<N; i++) {
            int flag = 0;
            for (int j = 0; j<aLength; j++) {
                if (aList.get(j) > flag) {
                    flag = aList.get(j);
                }
            }
            aList.remove(aList.indexOf(flag));
            aLength -= 1;
            if (AorB == 0) {
                AorB = 1;
                sumA += flag;
            } else {
                AorB = 0;
                sumB += flag;
            }
        }

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

        int N = Integer.parseInt(sc.next());
        List<Integer> aList = new ArrayList<Integer>();
        for (int i=0; i<N; i++) {
            aList.add(Integer.parseInt(sc.next()));
        }

        int AorB = 0;
        int sumA = 0;
        int sumB = 0;
        int aLength = N;

        for (int i=0; i<N; i++) {
            int flag = 0;
            for (int j = 0; j<aLength; j++) {
                if (aList.get(j) > flag) {
                    flag = aList.get(j);
                }
            }
            aList.remove(aList.indexOf(flag));
            aLength -= 1;
            if (AorB == 0) {
                AorB = 1;
                sumA += flag;
            } else {
                AorB = 0;
                sumB += flag;
            }
        }

        System.out.println(sumA - sumB);
    } main {
        Scanner sc = new Scanner(System.in);

        int N = Integer.parseInt(sc.next());
        List<Integer> aList = new ArrayList<Integer>();
        for (int i=0; i<N; i++) {
            aList.add(Integer.parseInt(sc.next()));
        }

        int AorB = 0;
        int sumA = 0;
        int sumB = 0;
        int aLength = N;

        for (int i=0; i<N; i++) {
            int flag = 0;
            for (int j = 0; j<aLength; j++) {
                if (aList.get(j) > flag) {
                    flag = aList.get(j);
                }
            }
            aList.remove(aList.indexOf(flag));
            aLength -= 1;
            if (AorB == 0) {
                AorB = 1;
                sumA += flag;
            } else {
                AorB = 0;
                sumB += flag;
            }
        }

        System.out.println(sumA - sumB);
    } 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> aList = new ArrayList<Integer>(); aList new ArrayList<Integer>() for (int i=0; i<N; i++) {
            aList.add(Integer.parseInt(sc.next()));
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            aList.add(Integer.parseInt(sc.next()));
        } {
            aList.add(Integer.parseInt(sc.next()));
        } aList.add(Integer.parseInt(sc.next())) aList.add aList Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int AorB = 0; AorB 0 int sumA = 0; sumA 0 int sumB = 0; sumB 0 int aLength = N; aLength N for (int i=0; i<N; i++) {
            int flag = 0;
            for (int j = 0; j<aLength; j++) {
                if (aList.get(j) > flag) {
                    flag = aList.get(j);
                }
            }
            aList.remove(aList.indexOf(flag));
            aLength -= 1;
            if (AorB == 0) {
                AorB = 1;
                sumA += flag;
            } else {
                AorB = 0;
                sumB += flag;
            }
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            int flag = 0;
            for (int j = 0; j<aLength; j++) {
                if (aList.get(j) > flag) {
                    flag = aList.get(j);
                }
            }
            aList.remove(aList.indexOf(flag));
            aLength -= 1;
            if (AorB == 0) {
                AorB = 1;
                sumA += flag;
            } else {
                AorB = 0;
                sumB += flag;
            }
        } {
            int flag = 0;
            for (int j = 0; j<aLength; j++) {
                if (aList.get(j) > flag) {
                    flag = aList.get(j);
                }
            }
            aList.remove(aList.indexOf(flag));
            aLength -= 1;
            if (AorB == 0) {
                AorB = 1;
                sumA += flag;
            } else {
                AorB = 0;
                sumB += flag;
            }
        } int flag = 0; flag 0 for (int j = 0; j<aLength; j++) {
                if (aList.get(j) > flag) {
                    flag = aList.get(j);
                }
            } int j = 0; int j = 0; j 0 j<aLength j aLength j++ j++ j {
                if (aList.get(j) > flag) {
                    flag = aList.get(j);
                }
            } {
                if (aList.get(j) > flag) {
                    flag = aList.get(j);
                }
            } if (aList.get(j) > flag) {
                    flag = aList.get(j);
                } aList.get(j) > flag aList.get(j) aList.get aList j flag {
                    flag = aList.get(j);
                } flag = aList.get(j) flag aList.get(j) aList.get aList j aList.remove(aList.indexOf(flag)) aList.remove aList aList.indexOf(flag) aList.indexOf aList flag aLength -= 1 aLength 1 if (AorB == 0) {
                AorB = 1;
                sumA += flag;
            } else {
                AorB = 0;
                sumB += flag;
            } AorB == 0 AorB 0 {
                AorB = 1;
                sumA += flag;
            } AorB = 1 AorB 1 sumA += flag sumA flag {
                AorB = 0;
                sumB += flag;
            } AorB = 0 AorB 0 sumB += flag sumB flag 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 = Integer.parseInt(sc.next());
        List<Integer> aList = new ArrayList<Integer>();
        for (int i=0; i<N; i++) {
            aList.add(Integer.parseInt(sc.next()));
        }

        int AorB = 0;
        int sumA = 0;
        int sumB = 0;
        int aLength = N;

        for (int i=0; i<N; i++) {
            int flag = 0;
            for (int j = 0; j<aLength; j++) {
                if (aList.get(j) > flag) {
                    flag = aList.get(j);
                }
            }
            aList.remove(aList.indexOf(flag));
            aLength -= 1;
            if (AorB == 0) {
                AorB = 1;
                sumA += flag;
            } else {
                AorB = 0;
                sumB += flag;
            }
        }

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

        int N = Integer.parseInt(sc.next());
        List<Integer> aList = new ArrayList<Integer>();
        for (int i=0; i<N; i++) {
            aList.add(Integer.parseInt(sc.next()));
        }

        int AorB = 0;
        int sumA = 0;
        int sumB = 0;
        int aLength = N;

        for (int i=0; i<N; i++) {
            int flag = 0;
            for (int j = 0; j<aLength; j++) {
                if (aList.get(j) > flag) {
                    flag = aList.get(j);
                }
            }
            aList.remove(aList.indexOf(flag));
            aLength -= 1;
            if (AorB == 0) {
                AorB = 1;
                sumA += flag;
            } else {
                AorB = 0;
                sumB += flag;
            }
        }

        System.out.println(sumA - sumB);
    }
} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

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

        int N = Integer.parseInt(sc.next());
        List<Integer> aList = new ArrayList<Integer>();
        for (int i=0; i<N; i++) {
            aList.add(Integer.parseInt(sc.next()));
        }

        int AorB = 0;
        int sumA = 0;
        int sumB = 0;
        int aLength = N;

        for (int i=0; i<N; i++) {
            int flag = 0;
            for (int j = 0; j<aLength; j++) {
                if (aList.get(j) > flag) {
                    flag = aList.get(j);
                }
            }
            aList.remove(aList.indexOf(flag));
            aLength -= 1;
            if (AorB == 0) {
                AorB = 1;
                sumA += flag;
            } else {
                AorB = 0;
                sumB += flag;
            }
        }

        System.out.println(sumA - sumB);
    }
}
