import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
        int N = sc.nextInt();
		int[] a = new int[100];
		for (int i=0; i <N; i++)
			a[i]=sc.nextInt();
		
		Arrays.sort(a);	
		
		int Alice = 0;
		int Bob = 0;

		for (int i=99; i >99-N; i--)
			if ( i % 2 == 1 )
			   Alice += a[i];
			else 
			Bob +=a[i];
			
		System.out.println( Alice - Bob );
	}
} import java.util.*; util.* java public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
        int N = sc.nextInt();
		int[] a = new int[100];
		for (int i=0; i <N; i++)
			a[i]=sc.nextInt();
		
		Arrays.sort(a);	
		
		int Alice = 0;
		int Bob = 0;

		for (int i=99; i >99-N; i--)
			if ( i % 2 == 1 )
			   Alice += a[i];
			else 
			Bob +=a[i];
			
		System.out.println( Alice - Bob );
	}
} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
        int N = sc.nextInt();
		int[] a = new int[100];
		for (int i=0; i <N; i++)
			a[i]=sc.nextInt();
		
		Arrays.sort(a);	
		
		int Alice = 0;
		int Bob = 0;

		for (int i=99; i >99-N; i--)
			if ( i % 2 == 1 )
			   Alice += a[i];
			else 
			Bob +=a[i];
			
		System.out.println( Alice - Bob );
	} main {
        int N = sc.nextInt();
		int[] a = new int[100];
		for (int i=0; i <N; i++)
			a[i]=sc.nextInt();
		
		Arrays.sort(a);	
		
		int Alice = 0;
		int Bob = 0;

		for (int i=99; i >99-N; i--)
			if ( i % 2 == 1 )
			   Alice += a[i];
			else 
			Bob +=a[i];
			
		System.out.println( Alice - Bob );
	} int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] a = new int[100]; a new int[100] 100 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] a i sc.nextInt() sc.nextInt sc Arrays.sort(a) Arrays.sort Arrays a int Alice = 0; Alice 0 int Bob = 0; Bob 0 for (int i=99; i >99-N; i--)
			if ( i % 2 == 1 )
			   Alice += a[i];
			else 
			Bob +=a[i]; int i=99; int i=99; i 99 i >99-N i 99-N 99 N i-- i-- i if ( i % 2 == 1 )
			   Alice += a[i];
			else 
			Bob +=a[i]; if ( i % 2 == 1 )
			   Alice += a[i];
			else 
			Bob +=a[i]; i % 2 == 1 i % 2 i 2 1 Alice += a[i] Alice a[i] a i Bob +=a[i] Bob a[i] a i System.out.println( Alice - Bob ) System.out.println System.out System System.out Alice - Bob Alice Bob String[] args args public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
        int N = sc.nextInt();
		int[] a = new int[100];
		for (int i=0; i <N; i++)
			a[i]=sc.nextInt();
		
		Arrays.sort(a);	
		
		int Alice = 0;
		int Bob = 0;

		for (int i=99; i >99-N; i--)
			if ( i % 2 == 1 )
			   Alice += a[i];
			else 
			Bob +=a[i];
			
		System.out.println( Alice - Bob );
	}
} public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
        int N = sc.nextInt();
		int[] a = new int[100];
		for (int i=0; i <N; i++)
			a[i]=sc.nextInt();
		
		Arrays.sort(a);	
		
		int Alice = 0;
		int Bob = 0;

		for (int i=99; i >99-N; i--)
			if ( i % 2 == 1 )
			   Alice += a[i];
			else 
			Bob +=a[i];
			
		System.out.println( Alice - Bob );
	}
} Main
import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
        int N = sc.nextInt();
		int[] a = new int[100];
		for (int i=0; i <N; i++)
			a[i]=sc.nextInt();
		
		Arrays.sort(a);	
		
		int Alice = 0;
		int Bob = 0;

		for (int i=99; i >99-N; i--)
			if ( i % 2 == 1 )
			   Alice += a[i];
			else 
			Bob +=a[i];
			
		System.out.println( Alice - Bob );
	}
}