import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int a = 0;
      int b = 0;
      int[] socres = new int[n];
      for(int i = 0 ; i < n ; i++) {
        	socres[i] = sc.nextInt();
      }
      Arrays.sort(socres);
      int i = n - 1;
      while(i >= 0) {
        a += socres[i--];
        if(i >= 0)
         	b += socres[i--];
      }
      System.out.println(a - b);
  }
} 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 = 0;
      int b = 0;
      int[] socres = new int[n];
      for(int i = 0 ; i < n ; i++) {
        	socres[i] = sc.nextInt();
      }
      Arrays.sort(socres);
      int i = n - 1;
      while(i >= 0) {
        a += socres[i--];
        if(i >= 0)
         	b += socres[i--];
      }
      System.out.println(a - b);
  }
} Main public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int a = 0;
      int b = 0;
      int[] socres = new int[n];
      for(int i = 0 ; i < n ; i++) {
        	socres[i] = sc.nextInt();
      }
      Arrays.sort(socres);
      int i = n - 1;
      while(i >= 0) {
        a += socres[i--];
        if(i >= 0)
         	b += socres[i--];
      }
      System.out.println(a - b);
  } main { 
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int a = 0;
      int b = 0;
      int[] socres = new int[n];
      for(int i = 0 ; i < n ; i++) {
        	socres[i] = sc.nextInt();
      }
      Arrays.sort(socres);
      int i = n - 1;
      while(i >= 0) {
        a += socres[i--];
        if(i >= 0)
         	b += socres[i--];
      }
      System.out.println(a - b);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int a = 0; a 0 int b = 0; b 0 int[] socres = new int[n]; socres new int[n] n for(int i = 0 ; i < n ; i++) {
        	socres[i] = sc.nextInt();
      } int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i {
        	socres[i] = sc.nextInt();
      } {
        	socres[i] = sc.nextInt();
      } socres[i] = sc.nextInt() socres[i] socres i sc.nextInt() sc.nextInt sc Arrays.sort(socres) Arrays.sort Arrays socres int i = n - 1; i n - 1 n 1 while(i >= 0) {
        a += socres[i--];
        if(i >= 0)
         	b += socres[i--];
      } i >= 0 i 0 {
        a += socres[i--];
        if(i >= 0)
         	b += socres[i--];
      } a += socres[i--] a socres[i--] socres i-- i if(i >= 0)
         	b += socres[i--]; i >= 0 i 0 b += socres[i--] b socres[i--] socres i-- i System.out.println(a - b) System.out.println System.out System System.out a - b a b String[] args args public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int a = 0;
      int b = 0;
      int[] socres = new int[n];
      for(int i = 0 ; i < n ; i++) {
        	socres[i] = sc.nextInt();
      }
      Arrays.sort(socres);
      int i = n - 1;
      while(i >= 0) {
        a += socres[i--];
        if(i >= 0)
         	b += socres[i--];
      }
      System.out.println(a - b);
  }
} public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int a = 0;
      int b = 0;
      int[] socres = new int[n];
      for(int i = 0 ; i < n ; i++) {
        	socres[i] = sc.nextInt();
      }
      Arrays.sort(socres);
      int i = n - 1;
      while(i >= 0) {
        a += socres[i--];
        if(i >= 0)
         	b += socres[i--];
      }
      System.out.println(a - b);
  }
} 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 = 0;
      int b = 0;
      int[] socres = new int[n];
      for(int i = 0 ; i < n ; i++) {
        	socres[i] = sc.nextInt();
      }
      Arrays.sort(socres);
      int i = n - 1;
      while(i >= 0) {
        a += socres[i--];
        if(i >= 0)
         	b += socres[i--];
      }
      System.out.println(a - b);
  }
}