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

public class Main {

	public static void main(String[] args) {

		int N;
		int[] a;

		try(Scanner sc = new Scanner(System.in)){
			N = sc.nextInt();
			a = new int[N];
			for(int i = 0; i < a.length; i++){
				a[i] = sc.nextInt();
			}
		}

		Arrays.sort(a);

		int point = 0;

		for(int i = a.length -1; i >= 0; i-=2){
			point += a[i];
		}
		for(int i = a.length -2; i >= 0; i-=2){
			point -= a[i];
		}

		System.out.println(point);
	}

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

	public static void main(String[] args) {

		int N;
		int[] a;

		try(Scanner sc = new Scanner(System.in)){
			N = sc.nextInt();
			a = new int[N];
			for(int i = 0; i < a.length; i++){
				a[i] = sc.nextInt();
			}
		}

		Arrays.sort(a);

		int point = 0;

		for(int i = a.length -1; i >= 0; i-=2){
			point += a[i];
		}
		for(int i = a.length -2; i >= 0; i-=2){
			point -= a[i];
		}

		System.out.println(point);
	}

} Main public static void main(String[] args) {

		int N;
		int[] a;

		try(Scanner sc = new Scanner(System.in)){
			N = sc.nextInt();
			a = new int[N];
			for(int i = 0; i < a.length; i++){
				a[i] = sc.nextInt();
			}
		}

		Arrays.sort(a);

		int point = 0;

		for(int i = a.length -1; i >= 0; i-=2){
			point += a[i];
		}
		for(int i = a.length -2; i >= 0; i-=2){
			point -= a[i];
		}

		System.out.println(point);
	} main {

		int N;
		int[] a;

		try(Scanner sc = new Scanner(System.in)){
			N = sc.nextInt();
			a = new int[N];
			for(int i = 0; i < a.length; i++){
				a[i] = sc.nextInt();
			}
		}

		Arrays.sort(a);

		int point = 0;

		for(int i = a.length -1; i >= 0; i-=2){
			point += a[i];
		}
		for(int i = a.length -2; i >= 0; i-=2){
			point -= a[i];
		}

		System.out.println(point);
	} int N; N int[] a; a try(Scanner sc = new Scanner(System.in)){
			N = sc.nextInt();
			a = new int[N];
			for(int i = 0; i < a.length; i++){
				a[i] = sc.nextInt();
			}
		} {
			N = sc.nextInt();
			a = new int[N];
			for(int i = 0; i < a.length; i++){
				a[i] = sc.nextInt();
			}
		} Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) N = sc.nextInt() N sc.nextInt() sc.nextInt sc a = new int[N] a new int[N] N for(int i = 0; i < a.length; i++){
				a[i] = sc.nextInt();
			} int i = 0; int i = 0; i 0 i < a.length i a.length a a.length 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) Arrays.sort Arrays a int point = 0; point 0 for(int i = a.length -1; i >= 0; i-=2){
			point += a[i];
		} int i = a.length -1; int i = a.length -1; i a.length -1 a.length a a.length 1 i >= 0 i 0 i-=2 i-=2 i 2 {
			point += a[i];
		} {
			point += a[i];
		} point += a[i] point a[i] a i for(int i = a.length -2; i >= 0; i-=2){
			point -= a[i];
		} int i = a.length -2; int i = a.length -2; i a.length -2 a.length a a.length 2 i >= 0 i 0 i-=2 i-=2 i 2 {
			point -= a[i];
		} {
			point -= a[i];
		} point -= a[i] point a[i] a i System.out.println(point) System.out.println System.out System System.out point String[] args args public class Main {

	public static void main(String[] args) {

		int N;
		int[] a;

		try(Scanner sc = new Scanner(System.in)){
			N = sc.nextInt();
			a = new int[N];
			for(int i = 0; i < a.length; i++){
				a[i] = sc.nextInt();
			}
		}

		Arrays.sort(a);

		int point = 0;

		for(int i = a.length -1; i >= 0; i-=2){
			point += a[i];
		}
		for(int i = a.length -2; i >= 0; i-=2){
			point -= a[i];
		}

		System.out.println(point);
	}

} public class Main {

	public static void main(String[] args) {

		int N;
		int[] a;

		try(Scanner sc = new Scanner(System.in)){
			N = sc.nextInt();
			a = new int[N];
			for(int i = 0; i < a.length; i++){
				a[i] = sc.nextInt();
			}
		}

		Arrays.sort(a);

		int point = 0;

		for(int i = a.length -1; i >= 0; i-=2){
			point += a[i];
		}
		for(int i = a.length -2; i >= 0; i-=2){
			point -= a[i];
		}

		System.out.println(point);
	}

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

public class Main {

	public static void main(String[] args) {

		int N;
		int[] a;

		try(Scanner sc = new Scanner(System.in)){
			N = sc.nextInt();
			a = new int[N];
			for(int i = 0; i < a.length; i++){
				a[i] = sc.nextInt();
			}
		}

		Arrays.sort(a);

		int point = 0;

		for(int i = a.length -1; i >= 0; i-=2){
			point += a[i];
		}
		for(int i = a.length -2; i >= 0; i-=2){
			point -= a[i];
		}

		System.out.println(point);
	}

}
