import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Stack;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) {
        FastReader f = new FastReader();
        // int [] arr = { 1 , 6 , 120 , 496 , 2016, 8128 ,32640 , 130816};
        byte n = f.nextByte();
        byte [] arr = new byte[n];
        for(byte i =0;i<arr.length ;i++){
            arr[i]=f.nextByte();
        }
        int AScore=0 , BScore=0;
        Arrays.sort(arr);
        for(byte i = (byte) (arr.length-1) ; i>=0 ;i-=2){
            if(i!=0){            
                byte j =(byte) (i-1);
                            BScore+=arr[j];

                         }
            AScore+=arr[i];
            
        }
        
        System.out.println(AScore-BScore);
     
    }   
 }


class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        byte nextByte() 
        { 
            return Byte.parseByte(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Arrays; Arrays java.util import java.util.LinkedList; LinkedList java.util import java.util.Queue; Queue java.util import java.util.Stack; Stack java.util import java.util.StringTokenizer; StringTokenizer java.util public class Main {

    public static void main(String[] args) {
        FastReader f = new FastReader();
        // int [] arr = { 1 , 6 , 120 , 496 , 2016, 8128 ,32640 , 130816};
        byte n = f.nextByte();
        byte [] arr = new byte[n];
        for(byte i =0;i<arr.length ;i++){
            arr[i]=f.nextByte();
        }
        int AScore=0 , BScore=0;
        Arrays.sort(arr);
        for(byte i = (byte) (arr.length-1) ; i>=0 ;i-=2){
            if(i!=0){            
                byte j =(byte) (i-1);
                            BScore+=arr[j];

                         }
            AScore+=arr[i];
            
        }
        
        System.out.println(AScore-BScore);
     
    }   
 } Main public static void main(String[] args) {
        FastReader f = new FastReader();
        // int [] arr = { 1 , 6 , 120 , 496 , 2016, 8128 ,32640 , 130816};
        byte n = f.nextByte();
        byte [] arr = new byte[n];
        for(byte i =0;i<arr.length ;i++){
            arr[i]=f.nextByte();
        }
        int AScore=0 , BScore=0;
        Arrays.sort(arr);
        for(byte i = (byte) (arr.length-1) ; i>=0 ;i-=2){
            if(i!=0){            
                byte j =(byte) (i-1);
                            BScore+=arr[j];

                         }
            AScore+=arr[i];
            
        }
        
        System.out.println(AScore-BScore);
     
    } main {
        FastReader f = new FastReader();
        // int [] arr = { 1 , 6 , 120 , 496 , 2016, 8128 ,32640 , 130816};
        byte n = f.nextByte();
        byte [] arr = new byte[n];
        for(byte i =0;i<arr.length ;i++){
            arr[i]=f.nextByte();
        }
        int AScore=0 , BScore=0;
        Arrays.sort(arr);
        for(byte i = (byte) (arr.length-1) ; i>=0 ;i-=2){
            if(i!=0){            
                byte j =(byte) (i-1);
                            BScore+=arr[j];

                         }
            AScore+=arr[i];
            
        }
        
        System.out.println(AScore-BScore);
     
    } FastReader f = new FastReader(); f new FastReader() byte n = f.nextByte(); n f.nextByte() f.nextByte f byte [] arr = new byte[n]; arr new byte[n] n for(byte i =0;i<arr.length ;i++){
            arr[i]=f.nextByte();
        } byte i =0; byte i =0; i 0 i<arr.length i arr.length arr arr.length i++ i++ i {
            arr[i]=f.nextByte();
        } {
            arr[i]=f.nextByte();
        } arr[i]=f.nextByte() arr[i] arr i f.nextByte() f.nextByte f int AScore=0 AScore 0 BScore=0; BScore 0 Arrays.sort(arr) Arrays.sort Arrays arr for(byte i = (byte) (arr.length-1) ; i>=0 ;i-=2){
            if(i!=0){            
                byte j =(byte) (i-1);
                            BScore+=arr[j];

                         }
            AScore+=arr[i];
            
        } byte i = (byte) (arr.length-1) ; byte i = (byte) (arr.length-1) ; i (byte) (arr.length-1) arr.length arr arr.length 1 i>=0 i 0 i-=2 i-=2 i 2 {
            if(i!=0){            
                byte j =(byte) (i-1);
                            BScore+=arr[j];

                         }
            AScore+=arr[i];
            
        } {
            if(i!=0){            
                byte j =(byte) (i-1);
                            BScore+=arr[j];

                         }
            AScore+=arr[i];
            
        } if(i!=0){            
                byte j =(byte) (i-1);
                            BScore+=arr[j];

                         } i!=0 i 0 {            
                byte j =(byte) (i-1);
                            BScore+=arr[j];

                         } byte j =(byte) (i-1); j (byte) (i-1) i 1 BScore+=arr[j] BScore arr[j] arr j AScore+=arr[i] AScore arr[i] arr i System.out.println(AScore-BScore) System.out.println System.out System System.out AScore-BScore AScore BScore String[] args args class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        byte nextByte() 
        { 
            return Byte.parseByte(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    
} FastReader BufferedReader br; br StringTokenizer st; st public FastReader() 
        { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } FastReader { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } br = new BufferedReader(new InputStreamReader(System.in)) br new BufferedReader(new InputStreamReader(System.in)) String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } next { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } st == null || !st.hasMoreElements() st == null st null !st.hasMoreElements() st.hasMoreElements() st.hasMoreElements st { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } IOException  e { 
                    e.printStackTrace(); 
                } e.printStackTrace() e.printStackTrace e { 
                    st = new StringTokenizer(br.readLine()); 
                } st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } nextInt { 
            return Integer.parseInt(next()); 
        } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next byte nextByte() 
        { 
            return Byte.parseByte(next()); 
        } nextByte { 
            return Byte.parseByte(next()); 
        } return Byte.parseByte(next()); Byte.parseByte(next()) Byte.parseByte Byte next() next long nextLong() 
        { 
            return Long.parseLong(next()); 
        } nextLong { 
            return Long.parseLong(next()); 
        } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } nextDouble { 
            return Double.parseDouble(next()); 
        } return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } nextLine { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } String str = ""; str "" try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } catch (IOException e) 
            { 
                e.printStackTrace(); 
            } IOException e { 
                e.printStackTrace(); 
            } e.printStackTrace() e.printStackTrace e { 
                str = br.readLine(); 
            } str = br.readLine() str br.readLine() br.readLine br return str; str public class Main {

    public static void main(String[] args) {
        FastReader f = new FastReader();
        // int [] arr = { 1 , 6 , 120 , 496 , 2016, 8128 ,32640 , 130816};
        byte n = f.nextByte();
        byte [] arr = new byte[n];
        for(byte i =0;i<arr.length ;i++){
            arr[i]=f.nextByte();
        }
        int AScore=0 , BScore=0;
        Arrays.sort(arr);
        for(byte i = (byte) (arr.length-1) ; i>=0 ;i-=2){
            if(i!=0){            
                byte j =(byte) (i-1);
                            BScore+=arr[j];

                         }
            AScore+=arr[i];
            
        }
        
        System.out.println(AScore-BScore);
     
    }   
 } public class Main {

    public static void main(String[] args) {
        FastReader f = new FastReader();
        // int [] arr = { 1 , 6 , 120 , 496 , 2016, 8128 ,32640 , 130816};
        byte n = f.nextByte();
        byte [] arr = new byte[n];
        for(byte i =0;i<arr.length ;i++){
            arr[i]=f.nextByte();
        }
        int AScore=0 , BScore=0;
        Arrays.sort(arr);
        for(byte i = (byte) (arr.length-1) ; i>=0 ;i-=2){
            if(i!=0){            
                byte j =(byte) (i-1);
                            BScore+=arr[j];

                         }
            AScore+=arr[i];
            
        }
        
        System.out.println(AScore-BScore);
     
    }   
 } Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Stack;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) {
        FastReader f = new FastReader();
        // int [] arr = { 1 , 6 , 120 , 496 , 2016, 8128 ,32640 , 130816};
        byte n = f.nextByte();
        byte [] arr = new byte[n];
        for(byte i =0;i<arr.length ;i++){
            arr[i]=f.nextByte();
        }
        int AScore=0 , BScore=0;
        Arrays.sort(arr);
        for(byte i = (byte) (arr.length-1) ; i>=0 ;i-=2){
            if(i!=0){            
                byte j =(byte) (i-1);
                            BScore+=arr[j];

                         }
            AScore+=arr[i];
            
        }
        
        System.out.println(AScore-BScore);
     
    }   
 }


class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        byte nextByte() 
        { 
            return Byte.parseByte(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    
}
