import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new java.util.Scanner(System.in);
    int alice = 0;
    int bob = 0;
    int N = Integer.parseInt(sc.nextLine());
    String[] sCards = sc.nextLine().split(" ");
    List<Integer> iCards = new ArrayList<>();
    for (int i = 0; i < N; i++) {
        iCards.add(Integer.parseInt(sCards[i]));
    }
    for (int n = 0; n < N; n++) {
      int max = 0;
      for (int c: iCards) {
        max = Math.max(max, c);
      }
      if (n == 0 || n % 2 == 0) {
        alice += max;
      } else {
        bob += max;
      }
      iCards.remove(iCards.indexOf(max));
    }
    System.out.println(alice - bob);
  }
} import java.lang.reflect.Array; Array java.lang.reflect 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 java.util.Scanner(System.in);
    int alice = 0;
    int bob = 0;
    int N = Integer.parseInt(sc.nextLine());
    String[] sCards = sc.nextLine().split(" ");
    List<Integer> iCards = new ArrayList<>();
    for (int i = 0; i < N; i++) {
        iCards.add(Integer.parseInt(sCards[i]));
    }
    for (int n = 0; n < N; n++) {
      int max = 0;
      for (int c: iCards) {
        max = Math.max(max, c);
      }
      if (n == 0 || n % 2 == 0) {
        alice += max;
      } else {
        bob += max;
      }
      iCards.remove(iCards.indexOf(max));
    }
    System.out.println(alice - bob);
  }
} Main public static void main(String[] args) {
    Scanner sc = new java.util.Scanner(System.in);
    int alice = 0;
    int bob = 0;
    int N = Integer.parseInt(sc.nextLine());
    String[] sCards = sc.nextLine().split(" ");
    List<Integer> iCards = new ArrayList<>();
    for (int i = 0; i < N; i++) {
        iCards.add(Integer.parseInt(sCards[i]));
    }
    for (int n = 0; n < N; n++) {
      int max = 0;
      for (int c: iCards) {
        max = Math.max(max, c);
      }
      if (n == 0 || n % 2 == 0) {
        alice += max;
      } else {
        bob += max;
      }
      iCards.remove(iCards.indexOf(max));
    }
    System.out.println(alice - bob);
  } main {
    Scanner sc = new java.util.Scanner(System.in);
    int alice = 0;
    int bob = 0;
    int N = Integer.parseInt(sc.nextLine());
    String[] sCards = sc.nextLine().split(" ");
    List<Integer> iCards = new ArrayList<>();
    for (int i = 0; i < N; i++) {
        iCards.add(Integer.parseInt(sCards[i]));
    }
    for (int n = 0; n < N; n++) {
      int max = 0;
      for (int c: iCards) {
        max = Math.max(max, c);
      }
      if (n == 0 || n % 2 == 0) {
        alice += max;
      } else {
        bob += max;
      }
      iCards.remove(iCards.indexOf(max));
    }
    System.out.println(alice - bob);
  } Scanner sc = new java.util.Scanner(System.in); sc new java.util.Scanner(System.in) int alice = 0; alice 0 int bob = 0; bob 0 int N = Integer.parseInt(sc.nextLine()); N Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc String[] sCards = sc.nextLine().split(" "); sCards sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " List<Integer> iCards = new ArrayList<>(); iCards new ArrayList<>() for (int i = 0; i < N; i++) {
        iCards.add(Integer.parseInt(sCards[i]));
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
        iCards.add(Integer.parseInt(sCards[i]));
    } {
        iCards.add(Integer.parseInt(sCards[i]));
    } iCards.add(Integer.parseInt(sCards[i])) iCards.add iCards Integer.parseInt(sCards[i]) Integer.parseInt Integer sCards[i] sCards i for (int n = 0; n < N; n++) {
      int max = 0;
      for (int c: iCards) {
        max = Math.max(max, c);
      }
      if (n == 0 || n % 2 == 0) {
        alice += max;
      } else {
        bob += max;
      }
      iCards.remove(iCards.indexOf(max));
    } int n = 0; int n = 0; n 0 n < N n N n++ n++ n {
      int max = 0;
      for (int c: iCards) {
        max = Math.max(max, c);
      }
      if (n == 0 || n % 2 == 0) {
        alice += max;
      } else {
        bob += max;
      }
      iCards.remove(iCards.indexOf(max));
    } {
      int max = 0;
      for (int c: iCards) {
        max = Math.max(max, c);
      }
      if (n == 0 || n % 2 == 0) {
        alice += max;
      } else {
        bob += max;
      }
      iCards.remove(iCards.indexOf(max));
    } int max = 0; max 0 for (int c: iCards) {
        max = Math.max(max, c);
      } int c iCards {
        max = Math.max(max, c);
      } {
        max = Math.max(max, c);
      } max = Math.max(max, c) max Math.max(max, c) Math.max Math max c if (n == 0 || n % 2 == 0) {
        alice += max;
      } else {
        bob += max;
      } n == 0 || n % 2 == 0 n == 0 n 0 n % 2 == 0 n % 2 n 2 0 {
        alice += max;
      } alice += max alice max {
        bob += max;
      } bob += max bob max iCards.remove(iCards.indexOf(max)) iCards.remove iCards iCards.indexOf(max) iCards.indexOf iCards max System.out.println(alice - bob) System.out.println System.out System System.out alice - bob alice bob String[] args args public class Main {
  public static void main(String[] args) {
    Scanner sc = new java.util.Scanner(System.in);
    int alice = 0;
    int bob = 0;
    int N = Integer.parseInt(sc.nextLine());
    String[] sCards = sc.nextLine().split(" ");
    List<Integer> iCards = new ArrayList<>();
    for (int i = 0; i < N; i++) {
        iCards.add(Integer.parseInt(sCards[i]));
    }
    for (int n = 0; n < N; n++) {
      int max = 0;
      for (int c: iCards) {
        max = Math.max(max, c);
      }
      if (n == 0 || n % 2 == 0) {
        alice += max;
      } else {
        bob += max;
      }
      iCards.remove(iCards.indexOf(max));
    }
    System.out.println(alice - bob);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new java.util.Scanner(System.in);
    int alice = 0;
    int bob = 0;
    int N = Integer.parseInt(sc.nextLine());
    String[] sCards = sc.nextLine().split(" ");
    List<Integer> iCards = new ArrayList<>();
    for (int i = 0; i < N; i++) {
        iCards.add(Integer.parseInt(sCards[i]));
    }
    for (int n = 0; n < N; n++) {
      int max = 0;
      for (int c: iCards) {
        max = Math.max(max, c);
      }
      if (n == 0 || n % 2 == 0) {
        alice += max;
      } else {
        bob += max;
      }
      iCards.remove(iCards.indexOf(max));
    }
    System.out.println(alice - bob);
  }
} Main
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new java.util.Scanner(System.in);
    int alice = 0;
    int bob = 0;
    int N = Integer.parseInt(sc.nextLine());
    String[] sCards = sc.nextLine().split(" ");
    List<Integer> iCards = new ArrayList<>();
    for (int i = 0; i < N; i++) {
        iCards.add(Integer.parseInt(sCards[i]));
    }
    for (int n = 0; n < N; n++) {
      int max = 0;
      for (int c: iCards) {
        max = Math.max(max, c);
      }
      if (n == 0 || n % 2 == 0) {
        alice += max;
      } else {
        bob += max;
      }
      iCards.remove(iCards.indexOf(max));
    }
    System.out.println(alice - bob);
  }
}
