import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] array = new int[100];
    
    int difference = 0;
    for(int i = 0; i < N; i++){
      array[i] = sc.nextInt();
    }
    Arrays.sort(array);
    
    int Alice = 0;
    int Bob = 0;
    for(int i = 99; i > 99-N; i--){
      if(i % 2 ==1){
        Alice += array[i];
      }else{
        Bob += array[i];
      }
    }
    System.out.println(Alice-Bob);
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] array = new int[100];
    
    int difference = 0;
    for(int i = 0; i < N; i++){
      array[i] = sc.nextInt();
    }
    Arrays.sort(array);
    
    int Alice = 0;
    int Bob = 0;
    for(int i = 99; i > 99-N; i--){
      if(i % 2 ==1){
        Alice += array[i];
      }else{
        Bob += array[i];
      }
    }
    System.out.println(Alice-Bob);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] array = new int[100];
    
    int difference = 0;
    for(int i = 0; i < N; i++){
      array[i] = sc.nextInt();
    }
    Arrays.sort(array);
    
    int Alice = 0;
    int Bob = 0;
    for(int i = 99; i > 99-N; i--){
      if(i % 2 ==1){
        Alice += array[i];
      }else{
        Bob += array[i];
      }
    }
    System.out.println(Alice-Bob);
  } main {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] array = new int[100];
    
    int difference = 0;
    for(int i = 0; i < N; i++){
      array[i] = sc.nextInt();
    }
    Arrays.sort(array);
    
    int Alice = 0;
    int Bob = 0;
    for(int i = 99; i > 99-N; i--){
      if(i % 2 ==1){
        Alice += array[i];
      }else{
        Bob += array[i];
      }
    }
    System.out.println(Alice-Bob);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] array = new int[100]; array new int[100] 100 int difference = 0; difference 0 for(int i = 0; i < N; i++){
      array[i] = sc.nextInt();
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
      array[i] = sc.nextInt();
    } {
      array[i] = sc.nextInt();
    } array[i] = sc.nextInt() array[i] array i sc.nextInt() sc.nextInt sc Arrays.sort(array) Arrays.sort Arrays array int Alice = 0; Alice 0 int Bob = 0; Bob 0 for(int i = 99; i > 99-N; i--){
      if(i % 2 ==1){
        Alice += array[i];
      }else{
        Bob += array[i];
      }
    } int i = 99; int i = 99; i 99 i > 99-N i 99-N 99 N i-- i-- i {
      if(i % 2 ==1){
        Alice += array[i];
      }else{
        Bob += array[i];
      }
    } {
      if(i % 2 ==1){
        Alice += array[i];
      }else{
        Bob += array[i];
      }
    } if(i % 2 ==1){
        Alice += array[i];
      }else{
        Bob += array[i];
      } i % 2 ==1 i % 2 i 2 1 {
        Alice += array[i];
      } Alice += array[i] Alice array[i] array i {
        Bob += array[i];
      } Bob += array[i] Bob array[i] array i 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 Scanner(System.in);
    int N = sc.nextInt();
    int[] array = new int[100];
    
    int difference = 0;
    for(int i = 0; i < N; i++){
      array[i] = sc.nextInt();
    }
    Arrays.sort(array);
    
    int Alice = 0;
    int Bob = 0;
    for(int i = 99; i > 99-N; i--){
      if(i % 2 ==1){
        Alice += array[i];
      }else{
        Bob += array[i];
      }
    }
    System.out.println(Alice-Bob);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] array = new int[100];
    
    int difference = 0;
    for(int i = 0; i < N; i++){
      array[i] = sc.nextInt();
    }
    Arrays.sort(array);
    
    int Alice = 0;
    int Bob = 0;
    for(int i = 99; i > 99-N; i--){
      if(i % 2 ==1){
        Alice += array[i];
      }else{
        Bob += array[i];
      }
    }
    System.out.println(Alice-Bob);
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] array = new int[100];
    
    int difference = 0;
    for(int i = 0; i < N; i++){
      array[i] = sc.nextInt();
    }
    Arrays.sort(array);
    
    int Alice = 0;
    int Bob = 0;
    for(int i = 99; i > 99-N; i--){
      if(i % 2 ==1){
        Alice += array[i];
      }else{
        Bob += array[i];
      }
    }
    System.out.println(Alice-Bob);
  }
}