import java.util.*;

public class Main {

	public static void main(String[] args) {

		//フィールド
		int n = 0;
		int kisu = 0;
		int gusu = 0;

		//入力
		Scanner scanner = new Scanner(System.in);
		n = scanner.nextInt();
		int intList[] = new int[n];

		for(int i = 0; i < n; i++) {
			int x = scanner.nextInt();
			intList[i] = x;
		}

		for(int i = 0; i < intList.length - 1 ; i++) {
			for(int j = intList.length - 1; j > i; j--) {
				if(intList[j] > intList[j-1]) {
					int x = intList[j-1];
					intList[j-1] = intList[j];
					intList[j] = x;
				}
			}
		}

		for(int i = 0; i < intList.length; i ++) {
			if(i % 2 == 0) {
				gusu = gusu + intList[i];
			}else{
				kisu = kisu + intList[i];
			}
		}

		System.out.println(gusu - kisu);

	}
} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {

		//フィールド
		int n = 0;
		int kisu = 0;
		int gusu = 0;

		//入力
		Scanner scanner = new Scanner(System.in);
		n = scanner.nextInt();
		int intList[] = new int[n];

		for(int i = 0; i < n; i++) {
			int x = scanner.nextInt();
			intList[i] = x;
		}

		for(int i = 0; i < intList.length - 1 ; i++) {
			for(int j = intList.length - 1; j > i; j--) {
				if(intList[j] > intList[j-1]) {
					int x = intList[j-1];
					intList[j-1] = intList[j];
					intList[j] = x;
				}
			}
		}

		for(int i = 0; i < intList.length; i ++) {
			if(i % 2 == 0) {
				gusu = gusu + intList[i];
			}else{
				kisu = kisu + intList[i];
			}
		}

		System.out.println(gusu - kisu);

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

		//フィールド
		int n = 0;
		int kisu = 0;
		int gusu = 0;

		//入力
		Scanner scanner = new Scanner(System.in);
		n = scanner.nextInt();
		int intList[] = new int[n];

		for(int i = 0; i < n; i++) {
			int x = scanner.nextInt();
			intList[i] = x;
		}

		for(int i = 0; i < intList.length - 1 ; i++) {
			for(int j = intList.length - 1; j > i; j--) {
				if(intList[j] > intList[j-1]) {
					int x = intList[j-1];
					intList[j-1] = intList[j];
					intList[j] = x;
				}
			}
		}

		for(int i = 0; i < intList.length; i ++) {
			if(i % 2 == 0) {
				gusu = gusu + intList[i];
			}else{
				kisu = kisu + intList[i];
			}
		}

		System.out.println(gusu - kisu);

	} main {

		//フィールド
		int n = 0;
		int kisu = 0;
		int gusu = 0;

		//入力
		Scanner scanner = new Scanner(System.in);
		n = scanner.nextInt();
		int intList[] = new int[n];

		for(int i = 0; i < n; i++) {
			int x = scanner.nextInt();
			intList[i] = x;
		}

		for(int i = 0; i < intList.length - 1 ; i++) {
			for(int j = intList.length - 1; j > i; j--) {
				if(intList[j] > intList[j-1]) {
					int x = intList[j-1];
					intList[j-1] = intList[j];
					intList[j] = x;
				}
			}
		}

		for(int i = 0; i < intList.length; i ++) {
			if(i % 2 == 0) {
				gusu = gusu + intList[i];
			}else{
				kisu = kisu + intList[i];
			}
		}

		System.out.println(gusu - kisu);

	} int n = 0; n 0 int kisu = 0; kisu 0 int gusu = 0; gusu 0 Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) n = scanner.nextInt() n scanner.nextInt() scanner.nextInt scanner int intList[] = new int[n]; intList new int[n] n for(int i = 0; i < n; i++) {
			int x = scanner.nextInt();
			intList[i] = x;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			int x = scanner.nextInt();
			intList[i] = x;
		} {
			int x = scanner.nextInt();
			intList[i] = x;
		} int x = scanner.nextInt(); x scanner.nextInt() scanner.nextInt scanner intList[i] = x intList[i] intList i x for(int i = 0; i < intList.length - 1 ; i++) {
			for(int j = intList.length - 1; j > i; j--) {
				if(intList[j] > intList[j-1]) {
					int x = intList[j-1];
					intList[j-1] = intList[j];
					intList[j] = x;
				}
			}
		} int i = 0; int i = 0; i 0 i < intList.length - 1 i intList.length - 1 intList.length intList intList.length 1 i++ i++ i {
			for(int j = intList.length - 1; j > i; j--) {
				if(intList[j] > intList[j-1]) {
					int x = intList[j-1];
					intList[j-1] = intList[j];
					intList[j] = x;
				}
			}
		} {
			for(int j = intList.length - 1; j > i; j--) {
				if(intList[j] > intList[j-1]) {
					int x = intList[j-1];
					intList[j-1] = intList[j];
					intList[j] = x;
				}
			}
		} for(int j = intList.length - 1; j > i; j--) {
				if(intList[j] > intList[j-1]) {
					int x = intList[j-1];
					intList[j-1] = intList[j];
					intList[j] = x;
				}
			} int j = intList.length - 1; int j = intList.length - 1; j intList.length - 1 intList.length intList intList.length 1 j > i j i j-- j-- j {
				if(intList[j] > intList[j-1]) {
					int x = intList[j-1];
					intList[j-1] = intList[j];
					intList[j] = x;
				}
			} {
				if(intList[j] > intList[j-1]) {
					int x = intList[j-1];
					intList[j-1] = intList[j];
					intList[j] = x;
				}
			} if(intList[j] > intList[j-1]) {
					int x = intList[j-1];
					intList[j-1] = intList[j];
					intList[j] = x;
				} intList[j] > intList[j-1] intList[j] intList j intList[j-1] intList j-1 j 1 {
					int x = intList[j-1];
					intList[j-1] = intList[j];
					intList[j] = x;
				} int x = intList[j-1]; x intList[j-1] intList j-1 j 1 intList[j-1] = intList[j] intList[j-1] intList j-1 j 1 intList[j] intList j intList[j] = x intList[j] intList j x for(int i = 0; i < intList.length; i ++) {
			if(i % 2 == 0) {
				gusu = gusu + intList[i];
			}else{
				kisu = kisu + intList[i];
			}
		} int i = 0; int i = 0; i 0 i < intList.length i intList.length intList intList.length i ++ i ++ i {
			if(i % 2 == 0) {
				gusu = gusu + intList[i];
			}else{
				kisu = kisu + intList[i];
			}
		} {
			if(i % 2 == 0) {
				gusu = gusu + intList[i];
			}else{
				kisu = kisu + intList[i];
			}
		} if(i % 2 == 0) {
				gusu = gusu + intList[i];
			}else{
				kisu = kisu + intList[i];
			} i % 2 == 0 i % 2 i 2 0 {
				gusu = gusu + intList[i];
			} gusu = gusu + intList[i] gusu gusu + intList[i] gusu intList[i] intList i {
				kisu = kisu + intList[i];
			} kisu = kisu + intList[i] kisu kisu + intList[i] kisu intList[i] intList i System.out.println(gusu - kisu) System.out.println System.out System System.out gusu - kisu gusu kisu String[] args args public class Main {

	public static void main(String[] args) {

		//フィールド
		int n = 0;
		int kisu = 0;
		int gusu = 0;

		//入力
		Scanner scanner = new Scanner(System.in);
		n = scanner.nextInt();
		int intList[] = new int[n];

		for(int i = 0; i < n; i++) {
			int x = scanner.nextInt();
			intList[i] = x;
		}

		for(int i = 0; i < intList.length - 1 ; i++) {
			for(int j = intList.length - 1; j > i; j--) {
				if(intList[j] > intList[j-1]) {
					int x = intList[j-1];
					intList[j-1] = intList[j];
					intList[j] = x;
				}
			}
		}

		for(int i = 0; i < intList.length; i ++) {
			if(i % 2 == 0) {
				gusu = gusu + intList[i];
			}else{
				kisu = kisu + intList[i];
			}
		}

		System.out.println(gusu - kisu);

	}
} public class Main {

	public static void main(String[] args) {

		//フィールド
		int n = 0;
		int kisu = 0;
		int gusu = 0;

		//入力
		Scanner scanner = new Scanner(System.in);
		n = scanner.nextInt();
		int intList[] = new int[n];

		for(int i = 0; i < n; i++) {
			int x = scanner.nextInt();
			intList[i] = x;
		}

		for(int i = 0; i < intList.length - 1 ; i++) {
			for(int j = intList.length - 1; j > i; j--) {
				if(intList[j] > intList[j-1]) {
					int x = intList[j-1];
					intList[j-1] = intList[j];
					intList[j] = x;
				}
			}
		}

		for(int i = 0; i < intList.length; i ++) {
			if(i % 2 == 0) {
				gusu = gusu + intList[i];
			}else{
				kisu = kisu + intList[i];
			}
		}

		System.out.println(gusu - kisu);

	}
} Main
import java.util.*;

public class Main {

	public static void main(String[] args) {

		//フィールド
		int n = 0;
		int kisu = 0;
		int gusu = 0;

		//入力
		Scanner scanner = new Scanner(System.in);
		n = scanner.nextInt();
		int intList[] = new int[n];

		for(int i = 0; i < n; i++) {
			int x = scanner.nextInt();
			intList[i] = x;
		}

		for(int i = 0; i < intList.length - 1 ; i++) {
			for(int j = intList.length - 1; j > i; j--) {
				if(intList[j] > intList[j-1]) {
					int x = intList[j-1];
					intList[j-1] = intList[j];
					intList[j] = x;
				}
			}
		}

		for(int i = 0; i < intList.length; i ++) {
			if(i % 2 == 0) {
				gusu = gusu + intList[i];
			}else{
				kisu = kisu + intList[i];
			}
		}

		System.out.println(gusu - kisu);

	}
}
