import java.util.*;
import java.io.*;

public class Main {	
	public static void main(String[] args) {
		FastScanner fs = new FastScanner();
		int N = fs.nextInt();
		int a[] = new int[N];
		int A = 0;
		int B = 0;

		for(int i=0; i<N; i++){
			a[i] = fs.nextInt();
		}
		Arrays.sort(a);

		for(int i=N-1; i>=0; i-=2){
			A += a[i];
		}
		for(int i=N-2; i>=0; i-=2){
			B += a[i];
		}

		System.out.println(A-B);




		

	}
	
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");

		public String next() {
			while (!st.hasMoreElements())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) {
				a[i]=nextInt();
			}
			return a;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

	}
	
} import java.util.*; util.* java import java.io.*; io.* java public class Main {	
	public static void main(String[] args) {
		FastScanner fs = new FastScanner();
		int N = fs.nextInt();
		int a[] = new int[N];
		int A = 0;
		int B = 0;

		for(int i=0; i<N; i++){
			a[i] = fs.nextInt();
		}
		Arrays.sort(a);

		for(int i=N-1; i>=0; i-=2){
			A += a[i];
		}
		for(int i=N-2; i>=0; i-=2){
			B += a[i];
		}

		System.out.println(A-B);




		

	}
	
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");

		public String next() {
			while (!st.hasMoreElements())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) {
				a[i]=nextInt();
			}
			return a;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

	}
	
} Main public static void main(String[] args) {
		FastScanner fs = new FastScanner();
		int N = fs.nextInt();
		int a[] = new int[N];
		int A = 0;
		int B = 0;

		for(int i=0; i<N; i++){
			a[i] = fs.nextInt();
		}
		Arrays.sort(a);

		for(int i=N-1; i>=0; i-=2){
			A += a[i];
		}
		for(int i=N-2; i>=0; i-=2){
			B += a[i];
		}

		System.out.println(A-B);




		

	} main {
		FastScanner fs = new FastScanner();
		int N = fs.nextInt();
		int a[] = new int[N];
		int A = 0;
		int B = 0;

		for(int i=0; i<N; i++){
			a[i] = fs.nextInt();
		}
		Arrays.sort(a);

		for(int i=N-1; i>=0; i-=2){
			A += a[i];
		}
		for(int i=N-2; i>=0; i-=2){
			B += a[i];
		}

		System.out.println(A-B);




		

	} FastScanner fs = new FastScanner(); fs new FastScanner() int N = fs.nextInt(); N fs.nextInt() fs.nextInt fs int a[] = new int[N]; a new int[N] N int A = 0; A 0 int B = 0; B 0 for(int i=0; i<N; i++){
			a[i] = fs.nextInt();
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			a[i] = fs.nextInt();
		} {
			a[i] = fs.nextInt();
		} a[i] = fs.nextInt() a[i] a i fs.nextInt() fs.nextInt fs Arrays.sort(a) Arrays.sort Arrays a for(int i=N-1; i>=0; i-=2){
			A += a[i];
		} int i=N-1; int i=N-1; i N-1 N 1 i>=0 i 0 i-=2 i-=2 i 2 {
			A += a[i];
		} {
			A += a[i];
		} A += a[i] A a[i] a i for(int i=N-2; i>=0; i-=2){
			B += a[i];
		} int i=N-2; int i=N-2; i N-2 N 2 i>=0 i 0 i-=2 i-=2 i 2 {
			B += a[i];
		} {
			B += a[i];
		} B += a[i] B a[i] a i System.out.println(A-B) System.out.println System.out System System.out A-B A B String[] args args static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");

		public String next() {
			while (!st.hasMoreElements())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) {
				a[i]=nextInt();
			}
			return a;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

	} FastScanner BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) StringTokenizer st=new StringTokenizer(""); st new StringTokenizer("") public String next() {
			while (!st.hasMoreElements())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		} next {
			while (!st.hasMoreElements())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		} while (!st.hasMoreElements())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				} !st.hasMoreElements() st.hasMoreElements() st.hasMoreElements st try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				} catch (IOException e) {
					e.printStackTrace();
				} IOException e {
					e.printStackTrace();
				} e.printStackTrace() e.printStackTrace e {
					st=new StringTokenizer(br.readLine());
				} st=new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st public int nextInt() {
			return Integer.parseInt(next());
		} nextInt {
			return Integer.parseInt(next());
		} return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public long nextLong() {
			return Long.parseLong(next());
		} nextLong {
			return Long.parseLong(next());
		} return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) {
				a[i]=nextInt();
			}
			return a;
		} readArray {
			int[] a=new int[n];
			for (int i=0; i<n; i++) {
				a[i]=nextInt();
			}
			return a;
		} int[] a=new int[n]; a new int[n] n for (int i=0; i<n; i++) {
				a[i]=nextInt();
			} int i=0; int i=0; i 0 i<n i n i++ i++ i {
				a[i]=nextInt();
			} {
				a[i]=nextInt();
			} a[i]=nextInt() a[i] a i nextInt() nextInt return a; a int n n public double nextDouble() {
			return Double.parseDouble(next());
		} nextDouble {
			return Double.parseDouble(next());
		} return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next public class Main {	
	public static void main(String[] args) {
		FastScanner fs = new FastScanner();
		int N = fs.nextInt();
		int a[] = new int[N];
		int A = 0;
		int B = 0;

		for(int i=0; i<N; i++){
			a[i] = fs.nextInt();
		}
		Arrays.sort(a);

		for(int i=N-1; i>=0; i-=2){
			A += a[i];
		}
		for(int i=N-2; i>=0; i-=2){
			B += a[i];
		}

		System.out.println(A-B);




		

	}
	
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");

		public String next() {
			while (!st.hasMoreElements())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) {
				a[i]=nextInt();
			}
			return a;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

	}
	
} public class Main {	
	public static void main(String[] args) {
		FastScanner fs = new FastScanner();
		int N = fs.nextInt();
		int a[] = new int[N];
		int A = 0;
		int B = 0;

		for(int i=0; i<N; i++){
			a[i] = fs.nextInt();
		}
		Arrays.sort(a);

		for(int i=N-1; i>=0; i-=2){
			A += a[i];
		}
		for(int i=N-2; i>=0; i-=2){
			B += a[i];
		}

		System.out.println(A-B);




		

	}
	
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");

		public String next() {
			while (!st.hasMoreElements())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) {
				a[i]=nextInt();
			}
			return a;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

	}
	
} Main
import java.util.*;
import java.io.*;

public class Main {	
	public static void main(String[] args) {
		FastScanner fs = new FastScanner();
		int N = fs.nextInt();
		int a[] = new int[N];
		int A = 0;
		int B = 0;

		for(int i=0; i<N; i++){
			a[i] = fs.nextInt();
		}
		Arrays.sort(a);

		for(int i=N-1; i>=0; i-=2){
			A += a[i];
		}
		for(int i=N-2; i>=0; i-=2){
			B += a[i];
		}

		System.out.println(A-B);




		

	}
	
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");

		public String next() {
			while (!st.hasMoreElements())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) {
				a[i]=nextInt();
			}
			return a;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

	}
	
}
