import java.util.Scanner;
import java.util.Arrays;
import java.util.Comparator;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int N = scan.nextInt();

	Integer[] a_ = new Integer[N];
	for(int i = 0; i < N; i++){
	    a_[i] = scan.nextInt();
	}

	Arrays.sort(a_, Comparator.reverseOrder());

	int point = 0;
	for(int i = 0; i < N; i++){
	    if(i % 2 == 0){
		point += a_[i];
	    }else{
		point -= a_[i];
	    }
	}

	System.out.println(point);
    }
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util import java.util.Comparator; Comparator java.util public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int N = scan.nextInt();

	Integer[] a_ = new Integer[N];
	for(int i = 0; i < N; i++){
	    a_[i] = scan.nextInt();
	}

	Arrays.sort(a_, Comparator.reverseOrder());

	int point = 0;
	for(int i = 0; i < N; i++){
	    if(i % 2 == 0){
		point += a_[i];
	    }else{
		point -= a_[i];
	    }
	}

	System.out.println(point);
    }
} Main public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int N = scan.nextInt();

	Integer[] a_ = new Integer[N];
	for(int i = 0; i < N; i++){
	    a_[i] = scan.nextInt();
	}

	Arrays.sort(a_, Comparator.reverseOrder());

	int point = 0;
	for(int i = 0; i < N; i++){
	    if(i % 2 == 0){
		point += a_[i];
	    }else{
		point -= a_[i];
	    }
	}

	System.out.println(point);
    } main {
	Scanner scan = new Scanner(System.in);

	int N = scan.nextInt();

	Integer[] a_ = new Integer[N];
	for(int i = 0; i < N; i++){
	    a_[i] = scan.nextInt();
	}

	Arrays.sort(a_, Comparator.reverseOrder());

	int point = 0;
	for(int i = 0; i < N; i++){
	    if(i % 2 == 0){
		point += a_[i];
	    }else{
		point -= a_[i];
	    }
	}

	System.out.println(point);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan Integer[] a_ = new Integer[N]; a_ new Integer[N] N for(int i = 0; i < N; i++){
	    a_[i] = scan.nextInt();
	} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
	    a_[i] = scan.nextInt();
	} {
	    a_[i] = scan.nextInt();
	} a_[i] = scan.nextInt() a_[i] a_ i scan.nextInt() scan.nextInt scan Arrays.sort(a_, Comparator.reverseOrder()) Arrays.sort Arrays a_ Comparator.reverseOrder() Comparator.reverseOrder Comparator int point = 0; point 0 for(int i = 0; i < N; i++){
	    if(i % 2 == 0){
		point += a_[i];
	    }else{
		point -= a_[i];
	    }
	} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
	    if(i % 2 == 0){
		point += a_[i];
	    }else{
		point -= a_[i];
	    }
	} {
	    if(i % 2 == 0){
		point += a_[i];
	    }else{
		point -= a_[i];
	    }
	} if(i % 2 == 0){
		point += a_[i];
	    }else{
		point -= a_[i];
	    } i % 2 == 0 i % 2 i 2 0 {
		point += a_[i];
	    } point += a_[i] point a_[i] a_ i {
		point -= a_[i];
	    } point -= a_[i] point a_[i] a_ i System.out.println(point) System.out.println System.out System System.out point String[] args args public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int N = scan.nextInt();

	Integer[] a_ = new Integer[N];
	for(int i = 0; i < N; i++){
	    a_[i] = scan.nextInt();
	}

	Arrays.sort(a_, Comparator.reverseOrder());

	int point = 0;
	for(int i = 0; i < N; i++){
	    if(i % 2 == 0){
		point += a_[i];
	    }else{
		point -= a_[i];
	    }
	}

	System.out.println(point);
    }
} public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int N = scan.nextInt();

	Integer[] a_ = new Integer[N];
	for(int i = 0; i < N; i++){
	    a_[i] = scan.nextInt();
	}

	Arrays.sort(a_, Comparator.reverseOrder());

	int point = 0;
	for(int i = 0; i < N; i++){
	    if(i % 2 == 0){
		point += a_[i];
	    }else{
		point -= a_[i];
	    }
	}

	System.out.println(point);
    }
} Main
import java.util.Scanner;
import java.util.Arrays;
import java.util.Comparator;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int N = scan.nextInt();

	Integer[] a_ = new Integer[N];
	for(int i = 0; i < N; i++){
	    a_[i] = scan.nextInt();
	}

	Arrays.sort(a_, Comparator.reverseOrder());

	int point = 0;
	for(int i = 0; i < N; i++){
	    if(i % 2 == 0){
		point += a_[i];
	    }else{
		point -= a_[i];
	    }
	}

	System.out.println(point);
    }
}
