import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//枚数入力
		int N = sc.nextInt();
		int a[] = new int[N+1];
		for(int i = 0;i < N;i++) {
			a[i] = sc.nextInt();
		}
		//大きい順に並び替え
		int max;
		for(int i = 0;i < N;i++) {
			for(int j = i;j < N;j++) {
				if(a[i]<a[j]) {
					max = a[i];
					a[i] = a[j];
					a[j] = max;			
				}
			}
		}
		int A = 0;
		int B = 0;
		for(int i = 0;i < N;i++) {
			if(i % 2 == 0) {
				A = A + a[i];
			}
			if(i % 2 != 0) {
				B = B + a[i];
			}
		}
		//得点差を絶対値化
		int point = Math.abs(A - B);
		System.out.println(point);
		sc.close();
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//枚数入力
		int N = sc.nextInt();
		int a[] = new int[N+1];
		for(int i = 0;i < N;i++) {
			a[i] = sc.nextInt();
		}
		//大きい順に並び替え
		int max;
		for(int i = 0;i < N;i++) {
			for(int j = i;j < N;j++) {
				if(a[i]<a[j]) {
					max = a[i];
					a[i] = a[j];
					a[j] = max;			
				}
			}
		}
		int A = 0;
		int B = 0;
		for(int i = 0;i < N;i++) {
			if(i % 2 == 0) {
				A = A + a[i];
			}
			if(i % 2 != 0) {
				B = B + a[i];
			}
		}
		//得点差を絶対値化
		int point = Math.abs(A - B);
		System.out.println(point);
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//枚数入力
		int N = sc.nextInt();
		int a[] = new int[N+1];
		for(int i = 0;i < N;i++) {
			a[i] = sc.nextInt();
		}
		//大きい順に並び替え
		int max;
		for(int i = 0;i < N;i++) {
			for(int j = i;j < N;j++) {
				if(a[i]<a[j]) {
					max = a[i];
					a[i] = a[j];
					a[j] = max;			
				}
			}
		}
		int A = 0;
		int B = 0;
		for(int i = 0;i < N;i++) {
			if(i % 2 == 0) {
				A = A + a[i];
			}
			if(i % 2 != 0) {
				B = B + a[i];
			}
		}
		//得点差を絶対値化
		int point = Math.abs(A - B);
		System.out.println(point);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		//枚数入力
		int N = sc.nextInt();
		int a[] = new int[N+1];
		for(int i = 0;i < N;i++) {
			a[i] = sc.nextInt();
		}
		//大きい順に並び替え
		int max;
		for(int i = 0;i < N;i++) {
			for(int j = i;j < N;j++) {
				if(a[i]<a[j]) {
					max = a[i];
					a[i] = a[j];
					a[j] = max;			
				}
			}
		}
		int A = 0;
		int B = 0;
		for(int i = 0;i < N;i++) {
			if(i % 2 == 0) {
				A = A + a[i];
			}
			if(i % 2 != 0) {
				B = B + a[i];
			}
		}
		//得点差を絶対値化
		int point = Math.abs(A - B);
		System.out.println(point);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int a[] = new int[N+1]; a new int[N+1] N+1 N 1 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 int max; max for(int i = 0;i < N;i++) {
			for(int j = i;j < N;j++) {
				if(a[i]<a[j]) {
					max = a[i];
					a[i] = a[j];
					a[j] = max;			
				}
			}
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			for(int j = i;j < N;j++) {
				if(a[i]<a[j]) {
					max = a[i];
					a[i] = a[j];
					a[j] = max;			
				}
			}
		} {
			for(int j = i;j < N;j++) {
				if(a[i]<a[j]) {
					max = a[i];
					a[i] = a[j];
					a[j] = max;			
				}
			}
		} for(int j = i;j < N;j++) {
				if(a[i]<a[j]) {
					max = a[i];
					a[i] = a[j];
					a[j] = max;			
				}
			} int j = i; int j = i; j i j < N j N j++ j++ j {
				if(a[i]<a[j]) {
					max = a[i];
					a[i] = a[j];
					a[j] = max;			
				}
			} {
				if(a[i]<a[j]) {
					max = a[i];
					a[i] = a[j];
					a[j] = max;			
				}
			} if(a[i]<a[j]) {
					max = a[i];
					a[i] = a[j];
					a[j] = max;			
				} a[i]<a[j] a[i] a i a[j] a j {
					max = a[i];
					a[i] = a[j];
					a[j] = max;			
				} max = a[i] max a[i] a i a[i] = a[j] a[i] a i a[j] a j a[j] = max a[j] a j max int A = 0; A 0 int B = 0; B 0 for(int i = 0;i < N;i++) {
			if(i % 2 == 0) {
				A = A + a[i];
			}
			if(i % 2 != 0) {
				B = B + a[i];
			}
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			if(i % 2 == 0) {
				A = A + a[i];
			}
			if(i % 2 != 0) {
				B = B + a[i];
			}
		} {
			if(i % 2 == 0) {
				A = A + a[i];
			}
			if(i % 2 != 0) {
				B = B + a[i];
			}
		} if(i % 2 == 0) {
				A = A + a[i];
			} i % 2 == 0 i % 2 i 2 0 {
				A = A + a[i];
			} A = A + a[i] A A + a[i] A a[i] a i if(i % 2 != 0) {
				B = B + a[i];
			} i % 2 != 0 i % 2 i 2 0 {
				B = B + a[i];
			} B = B + a[i] B B + a[i] B a[i] a i int point = Math.abs(A - B); point Math.abs(A - B) Math.abs Math A - B A B System.out.println(point) System.out.println System.out System System.out point 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 = sc.nextInt();
		int a[] = new int[N+1];
		for(int i = 0;i < N;i++) {
			a[i] = sc.nextInt();
		}
		//大きい順に並び替え
		int max;
		for(int i = 0;i < N;i++) {
			for(int j = i;j < N;j++) {
				if(a[i]<a[j]) {
					max = a[i];
					a[i] = a[j];
					a[j] = max;			
				}
			}
		}
		int A = 0;
		int B = 0;
		for(int i = 0;i < N;i++) {
			if(i % 2 == 0) {
				A = A + a[i];
			}
			if(i % 2 != 0) {
				B = B + a[i];
			}
		}
		//得点差を絶対値化
		int point = Math.abs(A - B);
		System.out.println(point);
		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//枚数入力
		int N = sc.nextInt();
		int a[] = new int[N+1];
		for(int i = 0;i < N;i++) {
			a[i] = sc.nextInt();
		}
		//大きい順に並び替え
		int max;
		for(int i = 0;i < N;i++) {
			for(int j = i;j < N;j++) {
				if(a[i]<a[j]) {
					max = a[i];
					a[i] = a[j];
					a[j] = max;			
				}
			}
		}
		int A = 0;
		int B = 0;
		for(int i = 0;i < N;i++) {
			if(i % 2 == 0) {
				A = A + a[i];
			}
			if(i % 2 != 0) {
				B = B + a[i];
			}
		}
		//得点差を絶対値化
		int point = Math.abs(A - B);
		System.out.println(point);
		sc.close();
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//枚数入力
		int N = sc.nextInt();
		int a[] = new int[N+1];
		for(int i = 0;i < N;i++) {
			a[i] = sc.nextInt();
		}
		//大きい順に並び替え
		int max;
		for(int i = 0;i < N;i++) {
			for(int j = i;j < N;j++) {
				if(a[i]<a[j]) {
					max = a[i];
					a[i] = a[j];
					a[j] = max;			
				}
			}
		}
		int A = 0;
		int B = 0;
		for(int i = 0;i < N;i++) {
			if(i % 2 == 0) {
				A = A + a[i];
			}
			if(i % 2 != 0) {
				B = B + a[i];
			}
		}
		//得点差を絶対値化
		int point = Math.abs(A - B);
		System.out.println(point);
		sc.close();
	}
}