import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		ArrayList<Integer> a = new ArrayList<Integer>();
		for(int i = 0; i < N; i ++) {
			a.add(stdIn.nextInt());
		}
		
		Collections.sort(a);
		
		int ans = 0;
		for(int i = a.size() - 1; 0 <= i; i --) {
			ans += a.get(i);
			if(0 <= i - 1) {
				i --;
				ans -= a.get(i);
			}
		}
		System.out.println(ans);
	}

} import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		ArrayList<Integer> a = new ArrayList<Integer>();
		for(int i = 0; i < N; i ++) {
			a.add(stdIn.nextInt());
		}
		
		Collections.sort(a);
		
		int ans = 0;
		for(int i = a.size() - 1; 0 <= i; i --) {
			ans += a.get(i);
			if(0 <= i - 1) {
				i --;
				ans -= a.get(i);
			}
		}
		System.out.println(ans);
	}

} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		ArrayList<Integer> a = new ArrayList<Integer>();
		for(int i = 0; i < N; i ++) {
			a.add(stdIn.nextInt());
		}
		
		Collections.sort(a);
		
		int ans = 0;
		for(int i = a.size() - 1; 0 <= i; i --) {
			ans += a.get(i);
			if(0 <= i - 1) {
				i --;
				ans -= a.get(i);
			}
		}
		System.out.println(ans);
	} main {
		// TODO Auto-generated method stub
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		ArrayList<Integer> a = new ArrayList<Integer>();
		for(int i = 0; i < N; i ++) {
			a.add(stdIn.nextInt());
		}
		
		Collections.sort(a);
		
		int ans = 0;
		for(int i = a.size() - 1; 0 <= i; i --) {
			ans += a.get(i);
			if(0 <= i - 1) {
				i --;
				ans -= a.get(i);
			}
		}
		System.out.println(ans);
	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int N = stdIn.nextInt(); N stdIn.nextInt() stdIn.nextInt stdIn ArrayList<Integer> a = new ArrayList<Integer>(); a new ArrayList<Integer>() for(int i = 0; i < N; i ++) {
			a.add(stdIn.nextInt());
		} int i = 0; int i = 0; i 0 i < N i N i ++ i ++ i {
			a.add(stdIn.nextInt());
		} {
			a.add(stdIn.nextInt());
		} a.add(stdIn.nextInt()) a.add a stdIn.nextInt() stdIn.nextInt stdIn Collections.sort(a) Collections.sort Collections a int ans = 0; ans 0 for(int i = a.size() - 1; 0 <= i; i --) {
			ans += a.get(i);
			if(0 <= i - 1) {
				i --;
				ans -= a.get(i);
			}
		} int i = a.size() - 1; int i = a.size() - 1; i a.size() - 1 a.size() a.size a 1 0 <= i 0 i i -- i -- i {
			ans += a.get(i);
			if(0 <= i - 1) {
				i --;
				ans -= a.get(i);
			}
		} {
			ans += a.get(i);
			if(0 <= i - 1) {
				i --;
				ans -= a.get(i);
			}
		} ans += a.get(i) ans a.get(i) a.get a i if(0 <= i - 1) {
				i --;
				ans -= a.get(i);
			} 0 <= i - 1 0 i - 1 i 1 {
				i --;
				ans -= a.get(i);
			} i -- i ans -= a.get(i) ans a.get(i) a.get a i System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		ArrayList<Integer> a = new ArrayList<Integer>();
		for(int i = 0; i < N; i ++) {
			a.add(stdIn.nextInt());
		}
		
		Collections.sort(a);
		
		int ans = 0;
		for(int i = a.size() - 1; 0 <= i; i --) {
			ans += a.get(i);
			if(0 <= i - 1) {
				i --;
				ans -= a.get(i);
			}
		}
		System.out.println(ans);
	}

} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		ArrayList<Integer> a = new ArrayList<Integer>();
		for(int i = 0; i < N; i ++) {
			a.add(stdIn.nextInt());
		}
		
		Collections.sort(a);
		
		int ans = 0;
		for(int i = a.size() - 1; 0 <= i; i --) {
			ans += a.get(i);
			if(0 <= i - 1) {
				i --;
				ans -= a.get(i);
			}
		}
		System.out.println(ans);
	}

} Main
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		ArrayList<Integer> a = new ArrayList<Integer>();
		for(int i = 0; i < N; i ++) {
			a.add(stdIn.nextInt());
		}
		
		Collections.sort(a);
		
		int ans = 0;
		for(int i = a.size() - 1; 0 <= i; i --) {
			ans += a.get(i);
			if(0 <= i - 1) {
				i --;
				ans -= a.get(i);
			}
		}
		System.out.println(ans);
	}

}