import java.util.*;
 
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    List<Integer> list = new ArrayList<Integer>();
    int num = sc.nextInt();
    
    while(sc.hasNext()){
      list.add(sc.nextInt());
    }
    Collections.sort(list,  Collections.reverseOrder());
    //System.out.println(list);
      
    int alisNum = 0;
    int bobNum = 0;
    for(int i = 0; i < num; i++){
    	if(i % 2 == 0){
        	alisNum += list.get(i);
          	//System.out.println(alisNum);
        } else {
          	bobNum += list.get(i);
            //System.out.println(bobNum);
        }  
    }  
    System.out.println(alisNum-bobNum);
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    List<Integer> list = new ArrayList<Integer>();
    int num = sc.nextInt();
    
    while(sc.hasNext()){
      list.add(sc.nextInt());
    }
    Collections.sort(list,  Collections.reverseOrder());
    //System.out.println(list);
      
    int alisNum = 0;
    int bobNum = 0;
    for(int i = 0; i < num; i++){
    	if(i % 2 == 0){
        	alisNum += list.get(i);
          	//System.out.println(alisNum);
        } else {
          	bobNum += list.get(i);
            //System.out.println(bobNum);
        }  
    }  
    System.out.println(alisNum-bobNum);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    List<Integer> list = new ArrayList<Integer>();
    int num = sc.nextInt();
    
    while(sc.hasNext()){
      list.add(sc.nextInt());
    }
    Collections.sort(list,  Collections.reverseOrder());
    //System.out.println(list);
      
    int alisNum = 0;
    int bobNum = 0;
    for(int i = 0; i < num; i++){
    	if(i % 2 == 0){
        	alisNum += list.get(i);
          	//System.out.println(alisNum);
        } else {
          	bobNum += list.get(i);
            //System.out.println(bobNum);
        }  
    }  
    System.out.println(alisNum-bobNum);
  } main {
    Scanner sc = new Scanner(System.in);
    List<Integer> list = new ArrayList<Integer>();
    int num = sc.nextInt();
    
    while(sc.hasNext()){
      list.add(sc.nextInt());
    }
    Collections.sort(list,  Collections.reverseOrder());
    //System.out.println(list);
      
    int alisNum = 0;
    int bobNum = 0;
    for(int i = 0; i < num; i++){
    	if(i % 2 == 0){
        	alisNum += list.get(i);
          	//System.out.println(alisNum);
        } else {
          	bobNum += list.get(i);
            //System.out.println(bobNum);
        }  
    }  
    System.out.println(alisNum-bobNum);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) List<Integer> list = new ArrayList<Integer>(); list new ArrayList<Integer>() int num = sc.nextInt(); num sc.nextInt() sc.nextInt sc while(sc.hasNext()){
      list.add(sc.nextInt());
    } sc.hasNext() sc.hasNext sc {
      list.add(sc.nextInt());
    } list.add(sc.nextInt()) list.add list sc.nextInt() sc.nextInt sc Collections.sort(list,  Collections.reverseOrder()) Collections.sort Collections list Collections.reverseOrder() Collections.reverseOrder Collections int alisNum = 0; alisNum 0 int bobNum = 0; bobNum 0 for(int i = 0; i < num; i++){
    	if(i % 2 == 0){
        	alisNum += list.get(i);
          	//System.out.println(alisNum);
        } else {
          	bobNum += list.get(i);
            //System.out.println(bobNum);
        }  
    } int i = 0; int i = 0; i 0 i < num i num i++ i++ i {
    	if(i % 2 == 0){
        	alisNum += list.get(i);
          	//System.out.println(alisNum);
        } else {
          	bobNum += list.get(i);
            //System.out.println(bobNum);
        }  
    } {
    	if(i % 2 == 0){
        	alisNum += list.get(i);
          	//System.out.println(alisNum);
        } else {
          	bobNum += list.get(i);
            //System.out.println(bobNum);
        }  
    } if(i % 2 == 0){
        	alisNum += list.get(i);
          	//System.out.println(alisNum);
        } else {
          	bobNum += list.get(i);
            //System.out.println(bobNum);
        } i % 2 == 0 i % 2 i 2 0 {
        	alisNum += list.get(i);
          	//System.out.println(alisNum);
        } alisNum += list.get(i) alisNum list.get(i) list.get list i {
          	bobNum += list.get(i);
            //System.out.println(bobNum);
        } bobNum += list.get(i) bobNum list.get(i) list.get list i System.out.println(alisNum-bobNum) System.out.println System.out System System.out alisNum-bobNum alisNum bobNum String[] args args public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    List<Integer> list = new ArrayList<Integer>();
    int num = sc.nextInt();
    
    while(sc.hasNext()){
      list.add(sc.nextInt());
    }
    Collections.sort(list,  Collections.reverseOrder());
    //System.out.println(list);
      
    int alisNum = 0;
    int bobNum = 0;
    for(int i = 0; i < num; i++){
    	if(i % 2 == 0){
        	alisNum += list.get(i);
          	//System.out.println(alisNum);
        } else {
          	bobNum += list.get(i);
            //System.out.println(bobNum);
        }  
    }  
    System.out.println(alisNum-bobNum);
  }
} public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    List<Integer> list = new ArrayList<Integer>();
    int num = sc.nextInt();
    
    while(sc.hasNext()){
      list.add(sc.nextInt());
    }
    Collections.sort(list,  Collections.reverseOrder());
    //System.out.println(list);
      
    int alisNum = 0;
    int bobNum = 0;
    for(int i = 0; i < num; i++){
    	if(i % 2 == 0){
        	alisNum += list.get(i);
          	//System.out.println(alisNum);
        } else {
          	bobNum += list.get(i);
            //System.out.println(bobNum);
        }  
    }  
    System.out.println(alisNum-bobNum);
  }
} Main
import java.util.*;
 
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    List<Integer> list = new ArrayList<Integer>();
    int num = sc.nextInt();
    
    while(sc.hasNext()){
      list.add(sc.nextInt());
    }
    Collections.sort(list,  Collections.reverseOrder());
    //System.out.println(list);
      
    int alisNum = 0;
    int bobNum = 0;
    for(int i = 0; i < num; i++){
    	if(i % 2 == 0){
        	alisNum += list.get(i);
          	//System.out.println(alisNum);
        } else {
          	bobNum += list.get(i);
            //System.out.println(bobNum);
        }  
    }  
    System.out.println(alisNum-bobNum);
  }
}