import java.util.*;
class Main
{
  public static void main(String[] args)
  {
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    int[] param = new int[n];
    
    for(int i=0 ; i<n ; i++){
      param[i] = sc.nextInt();
    }
    
    Arrays.sort(param);
    
    int alice = 0;
    int bob = 0;
    
    if(n%2==0){
      for(int i=0 ; i<n ; i++){
        if(i%2==0){
          bob += param[i];
        }else{
          alice += param[i];
        }
      }
    }else{
      for(int i=0 ; i<n ; i++){
        if(i%2==0){
          alice += param[i];
        }else{
          bob += param[i];
        }
      }
    }
    
    int total = alice - bob;
    System.out.println(total);
  }
} import java.util.*; util.* java class Main
{
  public static void main(String[] args)
  {
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    int[] param = new int[n];
    
    for(int i=0 ; i<n ; i++){
      param[i] = sc.nextInt();
    }
    
    Arrays.sort(param);
    
    int alice = 0;
    int bob = 0;
    
    if(n%2==0){
      for(int i=0 ; i<n ; i++){
        if(i%2==0){
          bob += param[i];
        }else{
          alice += param[i];
        }
      }
    }else{
      for(int i=0 ; i<n ; i++){
        if(i%2==0){
          alice += param[i];
        }else{
          bob += param[i];
        }
      }
    }
    
    int total = alice - bob;
    System.out.println(total);
  }
} Main public static void main(String[] args)
  {
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    int[] param = new int[n];
    
    for(int i=0 ; i<n ; i++){
      param[i] = sc.nextInt();
    }
    
    Arrays.sort(param);
    
    int alice = 0;
    int bob = 0;
    
    if(n%2==0){
      for(int i=0 ; i<n ; i++){
        if(i%2==0){
          bob += param[i];
        }else{
          alice += param[i];
        }
      }
    }else{
      for(int i=0 ; i<n ; i++){
        if(i%2==0){
          alice += param[i];
        }else{
          bob += param[i];
        }
      }
    }
    
    int total = alice - bob;
    System.out.println(total);
  } main {
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    int[] param = new int[n];
    
    for(int i=0 ; i<n ; i++){
      param[i] = sc.nextInt();
    }
    
    Arrays.sort(param);
    
    int alice = 0;
    int bob = 0;
    
    if(n%2==0){
      for(int i=0 ; i<n ; i++){
        if(i%2==0){
          bob += param[i];
        }else{
          alice += param[i];
        }
      }
    }else{
      for(int i=0 ; i<n ; i++){
        if(i%2==0){
          alice += param[i];
        }else{
          bob += param[i];
        }
      }
    }
    
    int total = alice - bob;
    System.out.println(total);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] param = new int[n]; param new int[n] n for(int i=0 ; i<n ; i++){
      param[i] = sc.nextInt();
    } int i=0 ; int i=0 ; i 0 i<n i n i++ i++ i {
      param[i] = sc.nextInt();
    } {
      param[i] = sc.nextInt();
    } param[i] = sc.nextInt() param[i] param i sc.nextInt() sc.nextInt sc Arrays.sort(param) Arrays.sort Arrays param int alice = 0; alice 0 int bob = 0; bob 0 if(n%2==0){
      for(int i=0 ; i<n ; i++){
        if(i%2==0){
          bob += param[i];
        }else{
          alice += param[i];
        }
      }
    }else{
      for(int i=0 ; i<n ; i++){
        if(i%2==0){
          alice += param[i];
        }else{
          bob += param[i];
        }
      }
    } n%2==0 n%2 n 2 0 {
      for(int i=0 ; i<n ; i++){
        if(i%2==0){
          bob += param[i];
        }else{
          alice += param[i];
        }
      }
    } for(int i=0 ; i<n ; i++){
        if(i%2==0){
          bob += param[i];
        }else{
          alice += param[i];
        }
      } int i=0 ; int i=0 ; i 0 i<n i n i++ i++ i {
        if(i%2==0){
          bob += param[i];
        }else{
          alice += param[i];
        }
      } {
        if(i%2==0){
          bob += param[i];
        }else{
          alice += param[i];
        }
      } if(i%2==0){
          bob += param[i];
        }else{
          alice += param[i];
        } i%2==0 i%2 i 2 0 {
          bob += param[i];
        } bob += param[i] bob param[i] param i {
          alice += param[i];
        } alice += param[i] alice param[i] param i {
      for(int i=0 ; i<n ; i++){
        if(i%2==0){
          alice += param[i];
        }else{
          bob += param[i];
        }
      }
    } for(int i=0 ; i<n ; i++){
        if(i%2==0){
          alice += param[i];
        }else{
          bob += param[i];
        }
      } int i=0 ; int i=0 ; i 0 i<n i n i++ i++ i {
        if(i%2==0){
          alice += param[i];
        }else{
          bob += param[i];
        }
      } {
        if(i%2==0){
          alice += param[i];
        }else{
          bob += param[i];
        }
      } if(i%2==0){
          alice += param[i];
        }else{
          bob += param[i];
        } i%2==0 i%2 i 2 0 {
          alice += param[i];
        } alice += param[i] alice param[i] param i {
          bob += param[i];
        } bob += param[i] bob param[i] param i int total = alice - bob; total alice - bob alice bob System.out.println(total) System.out.println System.out System System.out total String[] args args
import java.util.*;
class Main
{
  public static void main(String[] args)
  {
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    int[] param = new int[n];
    
    for(int i=0 ; i<n ; i++){
      param[i] = sc.nextInt();
    }
    
    Arrays.sort(param);
    
    int alice = 0;
    int bob = 0;
    
    if(n%2==0){
      for(int i=0 ; i<n ; i++){
        if(i%2==0){
          bob += param[i];
        }else{
          alice += param[i];
        }
      }
    }else{
      for(int i=0 ; i<n ; i++){
        if(i%2==0){
          alice += param[i];
        }else{
          bob += param[i];
        }
      }
    }
    
    int total = alice - bob;
    System.out.println(total);
  }
}