import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Integer[] a = new Integer[N];
		for(int i = 0;i<N;i++) {
			a[i]=sc.nextInt();
		}
		Arrays.sort(a,Comparator.reverseOrder());
		int AliceScore = 0;
		int BobScore = 0;
		for(int c=0;c<a.length;c++) {
		if(c%2==0) {
			AliceScore += a[c];
		}
		else {
			BobScore += a[c];
		}
		}
		System.out.println(AliceScore-BobScore);
	}
} import java.util.Arrays; Arrays java.util import java.util.Comparator; Comparator java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Integer[] a = new Integer[N];
		for(int i = 0;i<N;i++) {
			a[i]=sc.nextInt();
		}
		Arrays.sort(a,Comparator.reverseOrder());
		int AliceScore = 0;
		int BobScore = 0;
		for(int c=0;c<a.length;c++) {
		if(c%2==0) {
			AliceScore += a[c];
		}
		else {
			BobScore += a[c];
		}
		}
		System.out.println(AliceScore-BobScore);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Integer[] a = new Integer[N];
		for(int i = 0;i<N;i++) {
			a[i]=sc.nextInt();
		}
		Arrays.sort(a,Comparator.reverseOrder());
		int AliceScore = 0;
		int BobScore = 0;
		for(int c=0;c<a.length;c++) {
		if(c%2==0) {
			AliceScore += a[c];
		}
		else {
			BobScore += a[c];
		}
		}
		System.out.println(AliceScore-BobScore);
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Integer[] a = new Integer[N];
		for(int i = 0;i<N;i++) {
			a[i]=sc.nextInt();
		}
		Arrays.sort(a,Comparator.reverseOrder());
		int AliceScore = 0;
		int BobScore = 0;
		for(int c=0;c<a.length;c++) {
		if(c%2==0) {
			AliceScore += a[c];
		}
		else {
			BobScore += a[c];
		}
		}
		System.out.println(AliceScore-BobScore);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc Integer[] a = new Integer[N]; a new Integer[N] N 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]=sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc Arrays.sort(a,Comparator.reverseOrder()) Arrays.sort Arrays a Comparator.reverseOrder() Comparator.reverseOrder Comparator int AliceScore = 0; AliceScore 0 int BobScore = 0; BobScore 0 for(int c=0;c<a.length;c++) {
		if(c%2==0) {
			AliceScore += a[c];
		}
		else {
			BobScore += a[c];
		}
		} int c=0; int c=0; c 0 c<a.length c a.length a a.length c++ c++ c {
		if(c%2==0) {
			AliceScore += a[c];
		}
		else {
			BobScore += a[c];
		}
		} {
		if(c%2==0) {
			AliceScore += a[c];
		}
		else {
			BobScore += a[c];
		}
		} if(c%2==0) {
			AliceScore += a[c];
		}
		else {
			BobScore += a[c];
		} c%2==0 c%2 c 2 0 {
			AliceScore += a[c];
		} AliceScore += a[c] AliceScore a[c] a c {
			BobScore += a[c];
		} BobScore += a[c] BobScore a[c] a c System.out.println(AliceScore-BobScore) System.out.println System.out System System.out AliceScore-BobScore AliceScore BobScore String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Integer[] a = new Integer[N];
		for(int i = 0;i<N;i++) {
			a[i]=sc.nextInt();
		}
		Arrays.sort(a,Comparator.reverseOrder());
		int AliceScore = 0;
		int BobScore = 0;
		for(int c=0;c<a.length;c++) {
		if(c%2==0) {
			AliceScore += a[c];
		}
		else {
			BobScore += a[c];
		}
		}
		System.out.println(AliceScore-BobScore);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Integer[] a = new Integer[N];
		for(int i = 0;i<N;i++) {
			a[i]=sc.nextInt();
		}
		Arrays.sort(a,Comparator.reverseOrder());
		int AliceScore = 0;
		int BobScore = 0;
		for(int c=0;c<a.length;c++) {
		if(c%2==0) {
			AliceScore += a[c];
		}
		else {
			BobScore += a[c];
		}
		}
		System.out.println(AliceScore-BobScore);
	}
} Main
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Integer[] a = new Integer[N];
		for(int i = 0;i<N;i++) {
			a[i]=sc.nextInt();
		}
		Arrays.sort(a,Comparator.reverseOrder());
		int AliceScore = 0;
		int BobScore = 0;
		for(int c=0;c<a.length;c++) {
		if(c%2==0) {
			AliceScore += a[c];
		}
		else {
			BobScore += a[c];
		}
		}
		System.out.println(AliceScore-BobScore);
	}
}