import java.util.*;
import java.math.*;
public class Main {
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int sum = 0;
		
        List<Integer> a = new ArrayList<>();
        for (int i = 0; i < K; i++) {
            int d = sc.nextInt();
			a.add(d);
		}
		Collections.sort(a,Collections.reverseOrder());	
		
		for(int i=0; i<a.size();i++)
		{
			sum += (Math.pow((-1),(i)))*(a.get(i));
		}
		System.out.println(sum);
   
        }
		
	} import java.util.*; util.* java import java.math.*; math.* java public class Main {
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int sum = 0;
		
        List<Integer> a = new ArrayList<>();
        for (int i = 0; i < K; i++) {
            int d = sc.nextInt();
			a.add(d);
		}
		Collections.sort(a,Collections.reverseOrder());	
		
		for(int i=0; i<a.size();i++)
		{
			sum += (Math.pow((-1),(i)))*(a.get(i));
		}
		System.out.println(sum);
   
        }
		
	} Main public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int sum = 0;
		
        List<Integer> a = new ArrayList<>();
        for (int i = 0; i < K; i++) {
            int d = sc.nextInt();
			a.add(d);
		}
		Collections.sort(a,Collections.reverseOrder());	
		
		for(int i=0; i<a.size();i++)
		{
			sum += (Math.pow((-1),(i)))*(a.get(i));
		}
		System.out.println(sum);
   
        } main {
		
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int sum = 0;
		
        List<Integer> a = new ArrayList<>();
        for (int i = 0; i < K; i++) {
            int d = sc.nextInt();
			a.add(d);
		}
		Collections.sort(a,Collections.reverseOrder());	
		
		for(int i=0; i<a.size();i++)
		{
			sum += (Math.pow((-1),(i)))*(a.get(i));
		}
		System.out.println(sum);
   
        } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int K = sc.nextInt(); K sc.nextInt() sc.nextInt sc int sum = 0; sum 0 List<Integer> a = new ArrayList<>(); a new ArrayList<>() for (int i = 0; i < K; i++) {
            int d = sc.nextInt();
			a.add(d);
		} int i = 0; int i = 0; i 0 i < K i K i++ i++ i {
            int d = sc.nextInt();
			a.add(d);
		} {
            int d = sc.nextInt();
			a.add(d);
		} int d = sc.nextInt(); d sc.nextInt() sc.nextInt sc a.add(d) a.add a d Collections.sort(a,Collections.reverseOrder()) Collections.sort Collections a Collections.reverseOrder() Collections.reverseOrder Collections for(int i=0; i<a.size();i++)
		{
			sum += (Math.pow((-1),(i)))*(a.get(i));
		} int i=0; int i=0; i 0 i<a.size() i a.size() a.size a i++ i++ i {
			sum += (Math.pow((-1),(i)))*(a.get(i));
		} {
			sum += (Math.pow((-1),(i)))*(a.get(i));
		} sum += (Math.pow((-1),(i)))*(a.get(i)) sum (Math.pow((-1),(i)))*(a.get(i)) (Math.pow((-1),(i))) Math.pow Math (-1) 1 (i) (a.get(i)) a.get a i System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int sum = 0;
		
        List<Integer> a = new ArrayList<>();
        for (int i = 0; i < K; i++) {
            int d = sc.nextInt();
			a.add(d);
		}
		Collections.sort(a,Collections.reverseOrder());	
		
		for(int i=0; i<a.size();i++)
		{
			sum += (Math.pow((-1),(i)))*(a.get(i));
		}
		System.out.println(sum);
   
        }
		
	} public class Main {
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int sum = 0;
		
        List<Integer> a = new ArrayList<>();
        for (int i = 0; i < K; i++) {
            int d = sc.nextInt();
			a.add(d);
		}
		Collections.sort(a,Collections.reverseOrder());	
		
		for(int i=0; i<a.size();i++)
		{
			sum += (Math.pow((-1),(i)))*(a.get(i));
		}
		System.out.println(sum);
   
        }
		
	} Main
import java.util.*;
import java.math.*;
public class Main {
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int sum = 0;
		
        List<Integer> a = new ArrayList<>();
        for (int i = 0; i < K; i++) {
            int d = sc.nextInt();
			a.add(d);
		}
		Collections.sort(a,Collections.reverseOrder());	
		
		for(int i=0; i<a.size();i++)
		{
			sum += (Math.pow((-1),(i)))*(a.get(i));
		}
		System.out.println(sum);
   
        }
		
	}