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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N, b, c = 0, d = 0;
		N = sc.nextInt();
		Integer[] a = new Integer[N];
		for (int i = 0; i < N; i++) {
			b = sc.nextInt();
			a[i] = b;
		}
		Arrays.sort(a, Collections.reverseOrder());
		for (int i = 0; i < N; i++) {
			c += a[i];
			i++;
			if(i<N) {
			d += a[i];
			}
		}
		System.out.println(c - d);
		sc.close();
	}

} import java.util.Arrays; Arrays java.util import java.util.Collections; Collections 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, b, c = 0, d = 0;
		N = sc.nextInt();
		Integer[] a = new Integer[N];
		for (int i = 0; i < N; i++) {
			b = sc.nextInt();
			a[i] = b;
		}
		Arrays.sort(a, Collections.reverseOrder());
		for (int i = 0; i < N; i++) {
			c += a[i];
			i++;
			if(i<N) {
			d += a[i];
			}
		}
		System.out.println(c - d);
		sc.close();
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N, b, c = 0, d = 0;
		N = sc.nextInt();
		Integer[] a = new Integer[N];
		for (int i = 0; i < N; i++) {
			b = sc.nextInt();
			a[i] = b;
		}
		Arrays.sort(a, Collections.reverseOrder());
		for (int i = 0; i < N; i++) {
			c += a[i];
			i++;
			if(i<N) {
			d += a[i];
			}
		}
		System.out.println(c - d);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int N, b, c = 0, d = 0;
		N = sc.nextInt();
		Integer[] a = new Integer[N];
		for (int i = 0; i < N; i++) {
			b = sc.nextInt();
			a[i] = b;
		}
		Arrays.sort(a, Collections.reverseOrder());
		for (int i = 0; i < N; i++) {
			c += a[i];
			i++;
			if(i<N) {
			d += a[i];
			}
		}
		System.out.println(c - d);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N N b b c = 0 c 0 d = 0; d 0 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++) {
			b = sc.nextInt();
			a[i] = b;
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			b = sc.nextInt();
			a[i] = b;
		} {
			b = sc.nextInt();
			a[i] = b;
		} b = sc.nextInt() b sc.nextInt() sc.nextInt sc a[i] = b a[i] a i b Arrays.sort(a, Collections.reverseOrder()) Arrays.sort Arrays a Collections.reverseOrder() Collections.reverseOrder Collections for (int i = 0; i < N; i++) {
			c += a[i];
			i++;
			if(i<N) {
			d += a[i];
			}
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			c += a[i];
			i++;
			if(i<N) {
			d += a[i];
			}
		} {
			c += a[i];
			i++;
			if(i<N) {
			d += a[i];
			}
		} c += a[i] c a[i] a i i++ i if(i<N) {
			d += a[i];
			} i<N i N {
			d += a[i];
			} d += a[i] d a[i] a i System.out.println(c - d) System.out.println System.out System System.out c - d c d sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N, b, c = 0, d = 0;
		N = sc.nextInt();
		Integer[] a = new Integer[N];
		for (int i = 0; i < N; i++) {
			b = sc.nextInt();
			a[i] = b;
		}
		Arrays.sort(a, Collections.reverseOrder());
		for (int i = 0; i < N; i++) {
			c += a[i];
			i++;
			if(i<N) {
			d += a[i];
			}
		}
		System.out.println(c - d);
		sc.close();
	}

} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N, b, c = 0, d = 0;
		N = sc.nextInt();
		Integer[] a = new Integer[N];
		for (int i = 0; i < N; i++) {
			b = sc.nextInt();
			a[i] = b;
		}
		Arrays.sort(a, Collections.reverseOrder());
		for (int i = 0; i < N; i++) {
			c += a[i];
			i++;
			if(i<N) {
			d += a[i];
			}
		}
		System.out.println(c - d);
		sc.close();
	}

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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N, b, c = 0, d = 0;
		N = sc.nextInt();
		Integer[] a = new Integer[N];
		for (int i = 0; i < N; i++) {
			b = sc.nextInt();
			a[i] = b;
		}
		Arrays.sort(a, Collections.reverseOrder());
		for (int i = 0; i < N; i++) {
			c += a[i];
			i++;
			if(i<N) {
			d += a[i];
			}
		}
		System.out.println(c - d);
		sc.close();
	}

}