import java.util.*;
 
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] a = new int[N];
    for (int i=0;i<N;i++){
      a[i] = sc.nextInt();
    }
    int alice = 0;
    int bob = 0;
    for (int i=0;i<a.length;i++){
      int high = 0;
      int idx = -1;
      for (int j=0;j<a.length;j++){
        if (high<a[j]){
          high = a[j];
          idx = j;
        }
      }
      if ((i+1)%2==0){
        bob = bob + high;
      } else {
        alice = alice + high;
      }
      a[idx] = 0;
    }
    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[] a = new int[N];
    for (int i=0;i<N;i++){
      a[i] = sc.nextInt();
    }
    int alice = 0;
    int bob = 0;
    for (int i=0;i<a.length;i++){
      int high = 0;
      int idx = -1;
      for (int j=0;j<a.length;j++){
        if (high<a[j]){
          high = a[j];
          idx = j;
        }
      }
      if ((i+1)%2==0){
        bob = bob + high;
      } else {
        alice = alice + high;
      }
      a[idx] = 0;
    }
    System.out.println(alice - bob);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] a = new int[N];
    for (int i=0;i<N;i++){
      a[i] = sc.nextInt();
    }
    int alice = 0;
    int bob = 0;
    for (int i=0;i<a.length;i++){
      int high = 0;
      int idx = -1;
      for (int j=0;j<a.length;j++){
        if (high<a[j]){
          high = a[j];
          idx = j;
        }
      }
      if ((i+1)%2==0){
        bob = bob + high;
      } else {
        alice = alice + high;
      }
      a[idx] = 0;
    }
    System.out.println(alice - bob);
  } main {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] a = new int[N];
    for (int i=0;i<N;i++){
      a[i] = sc.nextInt();
    }
    int alice = 0;
    int bob = 0;
    for (int i=0;i<a.length;i++){
      int high = 0;
      int idx = -1;
      for (int j=0;j<a.length;j++){
        if (high<a[j]){
          high = a[j];
          idx = j;
        }
      }
      if ((i+1)%2==0){
        bob = bob + high;
      } else {
        alice = alice + high;
      }
      a[idx] = 0;
    }
    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[] a = new int[N]; a new int[N] N for (int i=0;i<N;i++){
      a[i] = sc.nextInt();
    } int i=0; int i=0; i 0 i<N i N i++ i++ i {
      a[i] = sc.nextInt();
    } {
      a[i] = sc.nextInt();
    } a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc int alice = 0; alice 0 int bob = 0; bob 0 for (int i=0;i<a.length;i++){
      int high = 0;
      int idx = -1;
      for (int j=0;j<a.length;j++){
        if (high<a[j]){
          high = a[j];
          idx = j;
        }
      }
      if ((i+1)%2==0){
        bob = bob + high;
      } else {
        alice = alice + high;
      }
      a[idx] = 0;
    } int i=0; int i=0; i 0 i<a.length i a.length a a.length i++ i++ i {
      int high = 0;
      int idx = -1;
      for (int j=0;j<a.length;j++){
        if (high<a[j]){
          high = a[j];
          idx = j;
        }
      }
      if ((i+1)%2==0){
        bob = bob + high;
      } else {
        alice = alice + high;
      }
      a[idx] = 0;
    } {
      int high = 0;
      int idx = -1;
      for (int j=0;j<a.length;j++){
        if (high<a[j]){
          high = a[j];
          idx = j;
        }
      }
      if ((i+1)%2==0){
        bob = bob + high;
      } else {
        alice = alice + high;
      }
      a[idx] = 0;
    } int high = 0; high 0 int idx = -1; idx -1 1 for (int j=0;j<a.length;j++){
        if (high<a[j]){
          high = a[j];
          idx = j;
        }
      } int j=0; int j=0; j 0 j<a.length j a.length a a.length j++ j++ j {
        if (high<a[j]){
          high = a[j];
          idx = j;
        }
      } {
        if (high<a[j]){
          high = a[j];
          idx = j;
        }
      } if (high<a[j]){
          high = a[j];
          idx = j;
        } high<a[j] high a[j] a j {
          high = a[j];
          idx = j;
        } high = a[j] high a[j] a j idx = j idx j if ((i+1)%2==0){
        bob = bob + high;
      } else {
        alice = alice + high;
      } (i+1)%2==0 (i+1)%2 (i+1) i 1 2 0 {
        bob = bob + high;
      } bob = bob + high bob bob + high bob high {
        alice = alice + high;
      } alice = alice + high alice alice + high alice high a[idx] = 0 a[idx] a idx 0 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[] a = new int[N];
    for (int i=0;i<N;i++){
      a[i] = sc.nextInt();
    }
    int alice = 0;
    int bob = 0;
    for (int i=0;i<a.length;i++){
      int high = 0;
      int idx = -1;
      for (int j=0;j<a.length;j++){
        if (high<a[j]){
          high = a[j];
          idx = j;
        }
      }
      if ((i+1)%2==0){
        bob = bob + high;
      } else {
        alice = alice + high;
      }
      a[idx] = 0;
    }
    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[] a = new int[N];
    for (int i=0;i<N;i++){
      a[i] = sc.nextInt();
    }
    int alice = 0;
    int bob = 0;
    for (int i=0;i<a.length;i++){
      int high = 0;
      int idx = -1;
      for (int j=0;j<a.length;j++){
        if (high<a[j]){
          high = a[j];
          idx = j;
        }
      }
      if ((i+1)%2==0){
        bob = bob + high;
      } else {
        alice = alice + high;
      }
      a[idx] = 0;
    }
    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[] a = new int[N];
    for (int i=0;i<N;i++){
      a[i] = sc.nextInt();
    }
    int alice = 0;
    int bob = 0;
    for (int i=0;i<a.length;i++){
      int high = 0;
      int idx = -1;
      for (int j=0;j<a.length;j++){
        if (high<a[j]){
          high = a[j];
          idx = j;
        }
      }
      if ((i+1)%2==0){
        bob = bob + high;
      } else {
        alice = alice + high;
      }
      a[idx] = 0;
    }
    System.out.println(alice - bob);
  }
}