import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int number = sc.nextInt();
    int[] cardList = new int[number];
    int scoreA = 0;
    int scoreB = 0;
    for(int i =0; i < number; i++){
     	cardList[i] = sc.nextInt(); //カード情報の格納
    }
    for(int i = 0; i < number; i++){ //お互いに最大値のカードを取る
      int maxCard = cardList[0];
      int position = 0; //最大値の位置
      for(int j = 1; j < number; j++){
          if(cardList[j] > maxCard){
            maxCard = cardList[j];
            position = j;
          }
      }
      cardList[position] = 0; //最大値の消去
      if( i % 2 == 0) scoreA += maxCard;
      else scoreB += maxCard;
    }
    System.out.println(scoreA - scoreB);
    
  }
} import java.util.Scanner; Scanner java.util public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int number = sc.nextInt();
    int[] cardList = new int[number];
    int scoreA = 0;
    int scoreB = 0;
    for(int i =0; i < number; i++){
     	cardList[i] = sc.nextInt(); //カード情報の格納
    }
    for(int i = 0; i < number; i++){ //お互いに最大値のカードを取る
      int maxCard = cardList[0];
      int position = 0; //最大値の位置
      for(int j = 1; j < number; j++){
          if(cardList[j] > maxCard){
            maxCard = cardList[j];
            position = j;
          }
      }
      cardList[position] = 0; //最大値の消去
      if( i % 2 == 0) scoreA += maxCard;
      else scoreB += maxCard;
    }
    System.out.println(scoreA - scoreB);
    
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int number = sc.nextInt();
    int[] cardList = new int[number];
    int scoreA = 0;
    int scoreB = 0;
    for(int i =0; i < number; i++){
     	cardList[i] = sc.nextInt(); //カード情報の格納
    }
    for(int i = 0; i < number; i++){ //お互いに最大値のカードを取る
      int maxCard = cardList[0];
      int position = 0; //最大値の位置
      for(int j = 1; j < number; j++){
          if(cardList[j] > maxCard){
            maxCard = cardList[j];
            position = j;
          }
      }
      cardList[position] = 0; //最大値の消去
      if( i % 2 == 0) scoreA += maxCard;
      else scoreB += maxCard;
    }
    System.out.println(scoreA - scoreB);
    
  } main {
    Scanner sc = new Scanner(System.in);
    int number = sc.nextInt();
    int[] cardList = new int[number];
    int scoreA = 0;
    int scoreB = 0;
    for(int i =0; i < number; i++){
     	cardList[i] = sc.nextInt(); //カード情報の格納
    }
    for(int i = 0; i < number; i++){ //お互いに最大値のカードを取る
      int maxCard = cardList[0];
      int position = 0; //最大値の位置
      for(int j = 1; j < number; j++){
          if(cardList[j] > maxCard){
            maxCard = cardList[j];
            position = j;
          }
      }
      cardList[position] = 0; //最大値の消去
      if( i % 2 == 0) scoreA += maxCard;
      else scoreB += maxCard;
    }
    System.out.println(scoreA - scoreB);
    
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int number = sc.nextInt(); number sc.nextInt() sc.nextInt sc int[] cardList = new int[number]; cardList new int[number] number int scoreA = 0; scoreA 0 int scoreB = 0; scoreB 0 for(int i =0; i < number; i++){
     	cardList[i] = sc.nextInt(); //カード情報の格納
    } int i =0; int i =0; i 0 i < number i number i++ i++ i {
     	cardList[i] = sc.nextInt(); //カード情報の格納
    } {
     	cardList[i] = sc.nextInt(); //カード情報の格納
    } cardList[i] = sc.nextInt() cardList[i] cardList i sc.nextInt() sc.nextInt sc for(int i = 0; i < number; i++){ //お互いに最大値のカードを取る
      int maxCard = cardList[0];
      int position = 0; //最大値の位置
      for(int j = 1; j < number; j++){
          if(cardList[j] > maxCard){
            maxCard = cardList[j];
            position = j;
          }
      }
      cardList[position] = 0; //最大値の消去
      if( i % 2 == 0) scoreA += maxCard;
      else scoreB += maxCard;
    } int i = 0; int i = 0; i 0 i < number i number i++ i++ i { //お互いに最大値のカードを取る
      int maxCard = cardList[0];
      int position = 0; //最大値の位置
      for(int j = 1; j < number; j++){
          if(cardList[j] > maxCard){
            maxCard = cardList[j];
            position = j;
          }
      }
      cardList[position] = 0; //最大値の消去
      if( i % 2 == 0) scoreA += maxCard;
      else scoreB += maxCard;
    } { //お互いに最大値のカードを取る
      int maxCard = cardList[0];
      int position = 0; //最大値の位置
      for(int j = 1; j < number; j++){
          if(cardList[j] > maxCard){
            maxCard = cardList[j];
            position = j;
          }
      }
      cardList[position] = 0; //最大値の消去
      if( i % 2 == 0) scoreA += maxCard;
      else scoreB += maxCard;
    } int maxCard = cardList[0]; maxCard cardList[0] cardList 0 int position = 0; position 0 for(int j = 1; j < number; j++){
          if(cardList[j] > maxCard){
            maxCard = cardList[j];
            position = j;
          }
      } int j = 1; int j = 1; j 1 j < number j number j++ j++ j {
          if(cardList[j] > maxCard){
            maxCard = cardList[j];
            position = j;
          }
      } {
          if(cardList[j] > maxCard){
            maxCard = cardList[j];
            position = j;
          }
      } if(cardList[j] > maxCard){
            maxCard = cardList[j];
            position = j;
          } cardList[j] > maxCard cardList[j] cardList j maxCard {
            maxCard = cardList[j];
            position = j;
          } maxCard = cardList[j] maxCard cardList[j] cardList j position = j position j cardList[position] = 0 cardList[position] cardList position 0 if( i % 2 == 0) scoreA += maxCard;
      else scoreB += maxCard; i % 2 == 0 i % 2 i 2 0 scoreA += maxCard scoreA maxCard scoreB += maxCard scoreB maxCard System.out.println(scoreA - scoreB) System.out.println System.out System System.out scoreA - scoreB scoreA scoreB String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int number = sc.nextInt();
    int[] cardList = new int[number];
    int scoreA = 0;
    int scoreB = 0;
    for(int i =0; i < number; i++){
     	cardList[i] = sc.nextInt(); //カード情報の格納
    }
    for(int i = 0; i < number; i++){ //お互いに最大値のカードを取る
      int maxCard = cardList[0];
      int position = 0; //最大値の位置
      for(int j = 1; j < number; j++){
          if(cardList[j] > maxCard){
            maxCard = cardList[j];
            position = j;
          }
      }
      cardList[position] = 0; //最大値の消去
      if( i % 2 == 0) scoreA += maxCard;
      else scoreB += maxCard;
    }
    System.out.println(scoreA - scoreB);
    
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int number = sc.nextInt();
    int[] cardList = new int[number];
    int scoreA = 0;
    int scoreB = 0;
    for(int i =0; i < number; i++){
     	cardList[i] = sc.nextInt(); //カード情報の格納
    }
    for(int i = 0; i < number; i++){ //お互いに最大値のカードを取る
      int maxCard = cardList[0];
      int position = 0; //最大値の位置
      for(int j = 1; j < number; j++){
          if(cardList[j] > maxCard){
            maxCard = cardList[j];
            position = j;
          }
      }
      cardList[position] = 0; //最大値の消去
      if( i % 2 == 0) scoreA += maxCard;
      else scoreB += maxCard;
    }
    System.out.println(scoreA - scoreB);
    
  }
} Main
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int number = sc.nextInt();
    int[] cardList = new int[number];
    int scoreA = 0;
    int scoreB = 0;
    for(int i =0; i < number; i++){
     	cardList[i] = sc.nextInt(); //カード情報の格納
    }
    for(int i = 0; i < number; i++){ //お互いに最大値のカードを取る
      int maxCard = cardList[0];
      int position = 0; //最大値の位置
      for(int j = 1; j < number; j++){
          if(cardList[j] > maxCard){
            maxCard = cardList[j];
            position = j;
          }
      }
      cardList[position] = 0; //最大値の消去
      if( i % 2 == 0) scoreA += maxCard;
      else scoreB += maxCard;
    }
    System.out.println(scoreA - scoreB);
    
  }
}