import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		PriorityQueue<Integer> que = new PriorityQueue<Integer>();
		int n = sc.nextInt();
		for(int i = 0;i < n; i++) {
			que.add(-1*sc.nextInt());
		}
		int ans = 0;
		for(int i = 0; i < n; i++) {
			if(i%2 == 0) ans -= que.poll();
			else ans += que.poll();
		}
		System.out.println(ans);
		sc.close();
	}
} import java.util.PriorityQueue; PriorityQueue java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		PriorityQueue<Integer> que = new PriorityQueue<Integer>();
		int n = sc.nextInt();
		for(int i = 0;i < n; i++) {
			que.add(-1*sc.nextInt());
		}
		int ans = 0;
		for(int i = 0; i < n; i++) {
			if(i%2 == 0) ans -= que.poll();
			else ans += que.poll();
		}
		System.out.println(ans);
		sc.close();
	}
} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		PriorityQueue<Integer> que = new PriorityQueue<Integer>();
		int n = sc.nextInt();
		for(int i = 0;i < n; i++) {
			que.add(-1*sc.nextInt());
		}
		int ans = 0;
		for(int i = 0; i < n; i++) {
			if(i%2 == 0) ans -= que.poll();
			else ans += que.poll();
		}
		System.out.println(ans);
		sc.close();
	} main {

		Scanner sc = new Scanner(System.in);
		PriorityQueue<Integer> que = new PriorityQueue<Integer>();
		int n = sc.nextInt();
		for(int i = 0;i < n; i++) {
			que.add(-1*sc.nextInt());
		}
		int ans = 0;
		for(int i = 0; i < n; i++) {
			if(i%2 == 0) ans -= que.poll();
			else ans += que.poll();
		}
		System.out.println(ans);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) PriorityQueue<Integer> que = new PriorityQueue<Integer>(); que new PriorityQueue<Integer>() int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc for(int i = 0;i < n; i++) {
			que.add(-1*sc.nextInt());
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			que.add(-1*sc.nextInt());
		} {
			que.add(-1*sc.nextInt());
		} que.add(-1*sc.nextInt()) que.add que -1*sc.nextInt() -1 1 sc.nextInt() sc.nextInt sc int ans = 0; ans 0 for(int i = 0; i < n; i++) {
			if(i%2 == 0) ans -= que.poll();
			else ans += que.poll();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			if(i%2 == 0) ans -= que.poll();
			else ans += que.poll();
		} {
			if(i%2 == 0) ans -= que.poll();
			else ans += que.poll();
		} if(i%2 == 0) ans -= que.poll();
			else ans += que.poll(); i%2 == 0 i%2 i 2 0 ans -= que.poll() ans que.poll() que.poll que ans += que.poll() ans que.poll() que.poll que System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		PriorityQueue<Integer> que = new PriorityQueue<Integer>();
		int n = sc.nextInt();
		for(int i = 0;i < n; i++) {
			que.add(-1*sc.nextInt());
		}
		int ans = 0;
		for(int i = 0; i < n; i++) {
			if(i%2 == 0) ans -= que.poll();
			else ans += que.poll();
		}
		System.out.println(ans);
		sc.close();
	}
} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		PriorityQueue<Integer> que = new PriorityQueue<Integer>();
		int n = sc.nextInt();
		for(int i = 0;i < n; i++) {
			que.add(-1*sc.nextInt());
		}
		int ans = 0;
		for(int i = 0; i < n; i++) {
			if(i%2 == 0) ans -= que.poll();
			else ans += que.poll();
		}
		System.out.println(ans);
		sc.close();
	}
} Main
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		PriorityQueue<Integer> que = new PriorityQueue<Integer>();
		int n = sc.nextInt();
		for(int i = 0;i < n; i++) {
			que.add(-1*sc.nextInt());
		}
		int ans = 0;
		for(int i = 0; i < n; i++) {
			if(i%2 == 0) ans -= que.poll();
			else ans += que.poll();
		}
		System.out.println(ans);
		sc.close();
	}
}