import java.util.*;

public class Main{
  public void battle(int n,int[] a) {
    int AP = 0;
    int BP = 0;
    int count = 0;
    
    for (int i = n-1;i >= 0;i--) {
      if (count%2== 0) AP += a[i];
      else BP += a[i];
      count++;
    }
    
    int SP = AP -BP;
    
    System.out.println(SP);
  }

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

    int N = scan.nextInt();
    
    int array[] = new int[N];
    
    for (int i = 0;i < N;i++) {
      array[i] = scan.nextInt();
    }
    
    Arrays.sort(array);
    
    Main main = new Main();
    
    main.battle(N,array);
  }
} import java.util.*; util.* java public class Main{
  public void battle(int n,int[] a) {
    int AP = 0;
    int BP = 0;
    int count = 0;
    
    for (int i = n-1;i >= 0;i--) {
      if (count%2== 0) AP += a[i];
      else BP += a[i];
      count++;
    }
    
    int SP = AP -BP;
    
    System.out.println(SP);
  }

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

    int N = scan.nextInt();
    
    int array[] = new int[N];
    
    for (int i = 0;i < N;i++) {
      array[i] = scan.nextInt();
    }
    
    Arrays.sort(array);
    
    Main main = new Main();
    
    main.battle(N,array);
  }
} Main public void battle(int n,int[] a) {
    int AP = 0;
    int BP = 0;
    int count = 0;
    
    for (int i = n-1;i >= 0;i--) {
      if (count%2== 0) AP += a[i];
      else BP += a[i];
      count++;
    }
    
    int SP = AP -BP;
    
    System.out.println(SP);
  } battle {
    int AP = 0;
    int BP = 0;
    int count = 0;
    
    for (int i = n-1;i >= 0;i--) {
      if (count%2== 0) AP += a[i];
      else BP += a[i];
      count++;
    }
    
    int SP = AP -BP;
    
    System.out.println(SP);
  } int AP = 0; AP 0 int BP = 0; BP 0 int count = 0; count 0 for (int i = n-1;i >= 0;i--) {
      if (count%2== 0) AP += a[i];
      else BP += a[i];
      count++;
    } int i = n-1; int i = n-1; i n-1 n 1 i >= 0 i 0 i-- i-- i {
      if (count%2== 0) AP += a[i];
      else BP += a[i];
      count++;
    } {
      if (count%2== 0) AP += a[i];
      else BP += a[i];
      count++;
    } if (count%2== 0) AP += a[i];
      else BP += a[i]; count%2== 0 count%2 count 2 0 AP += a[i] AP a[i] a i BP += a[i] BP a[i] a i count++ count int SP = AP -BP; SP AP -BP AP BP System.out.println(SP) System.out.println System.out System System.out SP int n n int[] a a public static void main (String args[]) {
    Scanner scan = new Scanner(System.in);

    int N = scan.nextInt();
    
    int array[] = new int[N];
    
    for (int i = 0;i < N;i++) {
      array[i] = scan.nextInt();
    }
    
    Arrays.sort(array);
    
    Main main = new Main();
    
    main.battle(N,array);
  } main {
    Scanner scan = new Scanner(System.in);

    int N = scan.nextInt();
    
    int array[] = new int[N];
    
    for (int i = 0;i < N;i++) {
      array[i] = scan.nextInt();
    }
    
    Arrays.sort(array);
    
    Main main = new Main();
    
    main.battle(N,array);
  } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan int array[] = new int[N]; array new int[N] N for (int i = 0;i < N;i++) {
      array[i] = scan.nextInt();
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
      array[i] = scan.nextInt();
    } {
      array[i] = scan.nextInt();
    } array[i] = scan.nextInt() array[i] array i scan.nextInt() scan.nextInt scan Arrays.sort(array) Arrays.sort Arrays array Main main = new Main(); main new Main() main.battle(N,array) main.battle main N array String args[] args public class Main{
  public void battle(int n,int[] a) {
    int AP = 0;
    int BP = 0;
    int count = 0;
    
    for (int i = n-1;i >= 0;i--) {
      if (count%2== 0) AP += a[i];
      else BP += a[i];
      count++;
    }
    
    int SP = AP -BP;
    
    System.out.println(SP);
  }

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

    int N = scan.nextInt();
    
    int array[] = new int[N];
    
    for (int i = 0;i < N;i++) {
      array[i] = scan.nextInt();
    }
    
    Arrays.sort(array);
    
    Main main = new Main();
    
    main.battle(N,array);
  }
} public class Main{
  public void battle(int n,int[] a) {
    int AP = 0;
    int BP = 0;
    int count = 0;
    
    for (int i = n-1;i >= 0;i--) {
      if (count%2== 0) AP += a[i];
      else BP += a[i];
      count++;
    }
    
    int SP = AP -BP;
    
    System.out.println(SP);
  }

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

    int N = scan.nextInt();
    
    int array[] = new int[N];
    
    for (int i = 0;i < N;i++) {
      array[i] = scan.nextInt();
    }
    
    Arrays.sort(array);
    
    Main main = new Main();
    
    main.battle(N,array);
  }
} Main
import java.util.*;

public class Main{
  public void battle(int n,int[] a) {
    int AP = 0;
    int BP = 0;
    int count = 0;
    
    for (int i = n-1;i >= 0;i--) {
      if (count%2== 0) AP += a[i];
      else BP += a[i];
      count++;
    }
    
    int SP = AP -BP;
    
    System.out.println(SP);
  }

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

    int N = scan.nextInt();
    
    int array[] = new int[N];
    
    for (int i = 0;i < N;i++) {
      array[i] = scan.nextInt();
    }
    
    Arrays.sort(array);
    
    Main main = new Main();
    
    main.battle(N,array);
  }
}