import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		Integer[] a = new Integer[n];
		List<Integer> alice = new ArrayList<Integer>();
		List<Integer> bob = new ArrayList<Integer>();
		for(int i=0;i<n;i++) {
			a[i]=scan.nextInt();
		}
		int countAli=0;
		int countBob=0;
		Arrays.sort(a,Collections.reverseOrder());
		for(int i=0;i<n;i++) {
			if(i%2==0) {
				alice.add(a[i]);
				countAli = countAli + a[i];
			}else {
				bob.add(a[i]);
				countBob = countBob+a[i];
			}
		}
		//System.out.println(alice);
		//System.out.println(bob);
		System.out.println(countAli-countBob);

	}

} import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.Collections; Collections java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		Integer[] a = new Integer[n];
		List<Integer> alice = new ArrayList<Integer>();
		List<Integer> bob = new ArrayList<Integer>();
		for(int i=0;i<n;i++) {
			a[i]=scan.nextInt();
		}
		int countAli=0;
		int countBob=0;
		Arrays.sort(a,Collections.reverseOrder());
		for(int i=0;i<n;i++) {
			if(i%2==0) {
				alice.add(a[i]);
				countAli = countAli + a[i];
			}else {
				bob.add(a[i]);
				countBob = countBob+a[i];
			}
		}
		//System.out.println(alice);
		//System.out.println(bob);
		System.out.println(countAli-countBob);

	}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		Integer[] a = new Integer[n];
		List<Integer> alice = new ArrayList<Integer>();
		List<Integer> bob = new ArrayList<Integer>();
		for(int i=0;i<n;i++) {
			a[i]=scan.nextInt();
		}
		int countAli=0;
		int countBob=0;
		Arrays.sort(a,Collections.reverseOrder());
		for(int i=0;i<n;i++) {
			if(i%2==0) {
				alice.add(a[i]);
				countAli = countAli + a[i];
			}else {
				bob.add(a[i]);
				countBob = countBob+a[i];
			}
		}
		//System.out.println(alice);
		//System.out.println(bob);
		System.out.println(countAli-countBob);

	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		Integer[] a = new Integer[n];
		List<Integer> alice = new ArrayList<Integer>();
		List<Integer> bob = new ArrayList<Integer>();
		for(int i=0;i<n;i++) {
			a[i]=scan.nextInt();
		}
		int countAli=0;
		int countBob=0;
		Arrays.sort(a,Collections.reverseOrder());
		for(int i=0;i<n;i++) {
			if(i%2==0) {
				alice.add(a[i]);
				countAli = countAli + a[i];
			}else {
				bob.add(a[i]);
				countBob = countBob+a[i];
			}
		}
		//System.out.println(alice);
		//System.out.println(bob);
		System.out.println(countAli-countBob);

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan Integer[] a = new Integer[n]; a new Integer[n] n List<Integer> alice = new ArrayList<Integer>(); alice new ArrayList<Integer>() List<Integer> bob = new ArrayList<Integer>(); bob new ArrayList<Integer>() for(int i=0;i<n;i++) {
			a[i]=scan.nextInt();
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			a[i]=scan.nextInt();
		} {
			a[i]=scan.nextInt();
		} a[i]=scan.nextInt() a[i] a i scan.nextInt() scan.nextInt scan int countAli=0; countAli 0 int countBob=0; countBob 0 Arrays.sort(a,Collections.reverseOrder()) Arrays.sort Arrays a Collections.reverseOrder() Collections.reverseOrder Collections for(int i=0;i<n;i++) {
			if(i%2==0) {
				alice.add(a[i]);
				countAli = countAli + a[i];
			}else {
				bob.add(a[i]);
				countBob = countBob+a[i];
			}
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			if(i%2==0) {
				alice.add(a[i]);
				countAli = countAli + a[i];
			}else {
				bob.add(a[i]);
				countBob = countBob+a[i];
			}
		} {
			if(i%2==0) {
				alice.add(a[i]);
				countAli = countAli + a[i];
			}else {
				bob.add(a[i]);
				countBob = countBob+a[i];
			}
		} if(i%2==0) {
				alice.add(a[i]);
				countAli = countAli + a[i];
			}else {
				bob.add(a[i]);
				countBob = countBob+a[i];
			} i%2==0 i%2 i 2 0 {
				alice.add(a[i]);
				countAli = countAli + a[i];
			} alice.add(a[i]) alice.add alice a[i] a i countAli = countAli + a[i] countAli countAli + a[i] countAli a[i] a i {
				bob.add(a[i]);
				countBob = countBob+a[i];
			} bob.add(a[i]) bob.add bob a[i] a i countBob = countBob+a[i] countBob countBob+a[i] countBob a[i] a i System.out.println(countAli-countBob) System.out.println System.out System System.out countAli-countBob countAli countBob String[] args args public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		Integer[] a = new Integer[n];
		List<Integer> alice = new ArrayList<Integer>();
		List<Integer> bob = new ArrayList<Integer>();
		for(int i=0;i<n;i++) {
			a[i]=scan.nextInt();
		}
		int countAli=0;
		int countBob=0;
		Arrays.sort(a,Collections.reverseOrder());
		for(int i=0;i<n;i++) {
			if(i%2==0) {
				alice.add(a[i]);
				countAli = countAli + a[i];
			}else {
				bob.add(a[i]);
				countBob = countBob+a[i];
			}
		}
		//System.out.println(alice);
		//System.out.println(bob);
		System.out.println(countAli-countBob);

	}

} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		Integer[] a = new Integer[n];
		List<Integer> alice = new ArrayList<Integer>();
		List<Integer> bob = new ArrayList<Integer>();
		for(int i=0;i<n;i++) {
			a[i]=scan.nextInt();
		}
		int countAli=0;
		int countBob=0;
		Arrays.sort(a,Collections.reverseOrder());
		for(int i=0;i<n;i++) {
			if(i%2==0) {
				alice.add(a[i]);
				countAli = countAli + a[i];
			}else {
				bob.add(a[i]);
				countBob = countBob+a[i];
			}
		}
		//System.out.println(alice);
		//System.out.println(bob);
		System.out.println(countAli-countBob);

	}

} Main
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		Integer[] a = new Integer[n];
		List<Integer> alice = new ArrayList<Integer>();
		List<Integer> bob = new ArrayList<Integer>();
		for(int i=0;i<n;i++) {
			a[i]=scan.nextInt();
		}
		int countAli=0;
		int countBob=0;
		Arrays.sort(a,Collections.reverseOrder());
		for(int i=0;i<n;i++) {
			if(i%2==0) {
				alice.add(a[i]);
				countAli = countAli + a[i];
			}else {
				bob.add(a[i]);
				countBob = countBob+a[i];
			}
		}
		//System.out.println(alice);
		//System.out.println(bob);
		System.out.println(countAli-countBob);

	}

}
