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];
		for(int i=0;i<N;i++){
			a[i]=sc.nextInt();
		}
		for(int i=0;i<N-1;i++) {
			for(int j=0;j<N-1-i;j++){
				if(a[j]<a[j+1]) {
                int temp = a[j];
                a[j] = a[j+1];
                a[j+1]= temp;
			}
		}
	}
		int countA=0;
		int countB=0;
		for(int i=0;i<N;i++) {
			if(i%2==0) {
				countA+=a[i];
			}
			else if(i%2==1){
				countB+=a[i];
			}
		}
		System.out.println(countA-countB);
		}
		} 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];
		for(int i=0;i<N;i++){
			a[i]=sc.nextInt();
		}
		for(int i=0;i<N-1;i++) {
			for(int j=0;j<N-1-i;j++){
				if(a[j]<a[j+1]) {
                int temp = a[j];
                a[j] = a[j+1];
                a[j+1]= temp;
			}
		}
	}
		int countA=0;
		int countB=0;
		for(int i=0;i<N;i++) {
			if(i%2==0) {
				countA+=a[i];
			}
			else if(i%2==1){
				countB+=a[i];
			}
		}
		System.out.println(countA-countB);
		}
		} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int []a= new int[N];
		for(int i=0;i<N;i++){
			a[i]=sc.nextInt();
		}
		for(int i=0;i<N-1;i++) {
			for(int j=0;j<N-1-i;j++){
				if(a[j]<a[j+1]) {
                int temp = a[j];
                a[j] = a[j+1];
                a[j+1]= temp;
			}
		}
	}
		int countA=0;
		int countB=0;
		for(int i=0;i<N;i++) {
			if(i%2==0) {
				countA+=a[i];
			}
			else if(i%2==1){
				countB+=a[i];
			}
		}
		System.out.println(countA-countB);
		} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int []a= new int[N];
		for(int i=0;i<N;i++){
			a[i]=sc.nextInt();
		}
		for(int i=0;i<N-1;i++) {
			for(int j=0;j<N-1-i;j++){
				if(a[j]<a[j+1]) {
                int temp = a[j];
                a[j] = a[j+1];
                a[j+1]= temp;
			}
		}
	}
		int countA=0;
		int countB=0;
		for(int i=0;i<N;i++) {
			if(i%2==0) {
				countA+=a[i];
			}
			else if(i%2==1){
				countB+=a[i];
			}
		}
		System.out.println(countA-countB);
		} 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]; a new int[N] N 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 for(int i=0;i<N-1;i++) {
			for(int j=0;j<N-1-i;j++){
				if(a[j]<a[j+1]) {
                int temp = a[j];
                a[j] = a[j+1];
                a[j+1]= temp;
			}
		}
	} int i=0; int i=0; i 0 i<N-1 i N-1 N 1 i++ i++ i {
			for(int j=0;j<N-1-i;j++){
				if(a[j]<a[j+1]) {
                int temp = a[j];
                a[j] = a[j+1];
                a[j+1]= temp;
			}
		}
	} {
			for(int j=0;j<N-1-i;j++){
				if(a[j]<a[j+1]) {
                int temp = a[j];
                a[j] = a[j+1];
                a[j+1]= temp;
			}
		}
	} for(int j=0;j<N-1-i;j++){
				if(a[j]<a[j+1]) {
                int temp = a[j];
                a[j] = a[j+1];
                a[j+1]= temp;
			}
		} int j=0; int j=0; j 0 j<N-1-i j N-1-i N-1-i N 1 i j++ j++ j {
				if(a[j]<a[j+1]) {
                int temp = a[j];
                a[j] = a[j+1];
                a[j+1]= temp;
			}
		} {
				if(a[j]<a[j+1]) {
                int temp = a[j];
                a[j] = a[j+1];
                a[j+1]= temp;
			}
		} if(a[j]<a[j+1]) {
                int temp = a[j];
                a[j] = a[j+1];
                a[j+1]= temp;
			} a[j]<a[j+1] a[j] a j a[j+1] a j+1 j 1 {
                int temp = a[j];
                a[j] = a[j+1];
                a[j+1]= temp;
			} int temp = a[j]; temp a[j] a j a[j] = a[j+1] a[j] a j a[j+1] a j+1 j 1 a[j+1]= temp a[j+1] a j+1 j 1 temp int countA=0; countA 0 int countB=0; countB 0 for(int i=0;i<N;i++) {
			if(i%2==0) {
				countA+=a[i];
			}
			else if(i%2==1){
				countB+=a[i];
			}
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			if(i%2==0) {
				countA+=a[i];
			}
			else if(i%2==1){
				countB+=a[i];
			}
		} {
			if(i%2==0) {
				countA+=a[i];
			}
			else if(i%2==1){
				countB+=a[i];
			}
		} if(i%2==0) {
				countA+=a[i];
			}
			else if(i%2==1){
				countB+=a[i];
			} i%2==0 i%2 i 2 0 {
				countA+=a[i];
			} countA+=a[i] countA a[i] a i if(i%2==1){
				countB+=a[i];
			} i%2==1 i%2 i 2 1 {
				countB+=a[i];
			} countB+=a[i] countB a[i] a i System.out.println(countA-countB) System.out.println System.out System System.out countA-countB countA countB 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];
		for(int i=0;i<N;i++){
			a[i]=sc.nextInt();
		}
		for(int i=0;i<N-1;i++) {
			for(int j=0;j<N-1-i;j++){
				if(a[j]<a[j+1]) {
                int temp = a[j];
                a[j] = a[j+1];
                a[j+1]= temp;
			}
		}
	}
		int countA=0;
		int countB=0;
		for(int i=0;i<N;i++) {
			if(i%2==0) {
				countA+=a[i];
			}
			else if(i%2==1){
				countB+=a[i];
			}
		}
		System.out.println(countA-countB);
		}
		} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int []a= new int[N];
		for(int i=0;i<N;i++){
			a[i]=sc.nextInt();
		}
		for(int i=0;i<N-1;i++) {
			for(int j=0;j<N-1-i;j++){
				if(a[j]<a[j+1]) {
                int temp = a[j];
                a[j] = a[j+1];
                a[j+1]= temp;
			}
		}
	}
		int countA=0;
		int countB=0;
		for(int i=0;i<N;i++) {
			if(i%2==0) {
				countA+=a[i];
			}
			else if(i%2==1){
				countB+=a[i];
			}
		}
		System.out.println(countA-countB);
		}
		} 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];
		for(int i=0;i<N;i++){
			a[i]=sc.nextInt();
		}
		for(int i=0;i<N-1;i++) {
			for(int j=0;j<N-1-i;j++){
				if(a[j]<a[j+1]) {
                int temp = a[j];
                a[j] = a[j+1];
                a[j+1]= temp;
			}
		}
	}
		int countA=0;
		int countB=0;
		for(int i=0;i<N;i++) {
			if(i%2==0) {
				countA+=a[i];
			}
			else if(i%2==1){
				countB+=a[i];
			}
		}
		System.out.println(countA-countB);
		}
		}