import java.util.*;
 
public class Main{
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt(); 
      
      List<Integer> split = new ArrayList<>();
        for (int i = 0; i < n; i++) {
	        int buf = sc.nextInt();
	        split.add(buf);
        }
        
        int resultsA = 0;
        int resultsB = 0;
        int max = 0;
        int index = 0;
        int size = split.size();
        String current = "A";
        int count = 0;
        Boolean boo = true;
        
        while(boo){
            for(int i = 0; i < size ; i++ ){
                if(max<=split.get(i)){
                    max = split.get(i);
                    index = i;
                }
            }
            split.remove(index);
            size -= 1;
            if(current.equals("A")){
                resultsA += max;
                current = "B";
            }else{
                resultsB += max;
                current = "A";
            }
            max = 0;
            if(size==0){
                boo = false;
            }
        }
        
        count = resultsA - resultsB;
	    
    System.out.println(count);
  }
} import java.util.*; util.* java public class Main{
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt(); 
      
      List<Integer> split = new ArrayList<>();
        for (int i = 0; i < n; i++) {
	        int buf = sc.nextInt();
	        split.add(buf);
        }
        
        int resultsA = 0;
        int resultsB = 0;
        int max = 0;
        int index = 0;
        int size = split.size();
        String current = "A";
        int count = 0;
        Boolean boo = true;
        
        while(boo){
            for(int i = 0; i < size ; i++ ){
                if(max<=split.get(i)){
                    max = split.get(i);
                    index = i;
                }
            }
            split.remove(index);
            size -= 1;
            if(current.equals("A")){
                resultsA += max;
                current = "B";
            }else{
                resultsB += max;
                current = "A";
            }
            max = 0;
            if(size==0){
                boo = false;
            }
        }
        
        count = resultsA - resultsB;
	    
    System.out.println(count);
  }
} Main public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt(); 
      
      List<Integer> split = new ArrayList<>();
        for (int i = 0; i < n; i++) {
	        int buf = sc.nextInt();
	        split.add(buf);
        }
        
        int resultsA = 0;
        int resultsB = 0;
        int max = 0;
        int index = 0;
        int size = split.size();
        String current = "A";
        int count = 0;
        Boolean boo = true;
        
        while(boo){
            for(int i = 0; i < size ; i++ ){
                if(max<=split.get(i)){
                    max = split.get(i);
                    index = i;
                }
            }
            split.remove(index);
            size -= 1;
            if(current.equals("A")){
                resultsA += max;
                current = "B";
            }else{
                resultsB += max;
                current = "A";
            }
            max = 0;
            if(size==0){
                boo = false;
            }
        }
        
        count = resultsA - resultsB;
	    
    System.out.println(count);
  } main {
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt(); 
      
      List<Integer> split = new ArrayList<>();
        for (int i = 0; i < n; i++) {
	        int buf = sc.nextInt();
	        split.add(buf);
        }
        
        int resultsA = 0;
        int resultsB = 0;
        int max = 0;
        int index = 0;
        int size = split.size();
        String current = "A";
        int count = 0;
        Boolean boo = true;
        
        while(boo){
            for(int i = 0; i < size ; i++ ){
                if(max<=split.get(i)){
                    max = split.get(i);
                    index = i;
                }
            }
            split.remove(index);
            size -= 1;
            if(current.equals("A")){
                resultsA += max;
                current = "B";
            }else{
                resultsB += max;
                current = "A";
            }
            max = 0;
            if(size==0){
                boo = false;
            }
        }
        
        count = resultsA - resultsB;
	    
    System.out.println(count);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc List<Integer> split = new ArrayList<>(); split new ArrayList<>() for (int i = 0; i < n; i++) {
	        int buf = sc.nextInt();
	        split.add(buf);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
	        int buf = sc.nextInt();
	        split.add(buf);
        } {
	        int buf = sc.nextInt();
	        split.add(buf);
        } int buf = sc.nextInt(); buf sc.nextInt() sc.nextInt sc split.add(buf) split.add split buf int resultsA = 0; resultsA 0 int resultsB = 0; resultsB 0 int max = 0; max 0 int index = 0; index 0 int size = split.size(); size split.size() split.size split String current = "A"; current "A" int count = 0; count 0 Boolean boo = true; boo true while(boo){
            for(int i = 0; i < size ; i++ ){
                if(max<=split.get(i)){
                    max = split.get(i);
                    index = i;
                }
            }
            split.remove(index);
            size -= 1;
            if(current.equals("A")){
                resultsA += max;
                current = "B";
            }else{
                resultsB += max;
                current = "A";
            }
            max = 0;
            if(size==0){
                boo = false;
            }
        } boo {
            for(int i = 0; i < size ; i++ ){
                if(max<=split.get(i)){
                    max = split.get(i);
                    index = i;
                }
            }
            split.remove(index);
            size -= 1;
            if(current.equals("A")){
                resultsA += max;
                current = "B";
            }else{
                resultsB += max;
                current = "A";
            }
            max = 0;
            if(size==0){
                boo = false;
            }
        } for(int i = 0; i < size ; i++ ){
                if(max<=split.get(i)){
                    max = split.get(i);
                    index = i;
                }
            } int i = 0; int i = 0; i 0 i < size i size i++ i++ i {
                if(max<=split.get(i)){
                    max = split.get(i);
                    index = i;
                }
            } {
                if(max<=split.get(i)){
                    max = split.get(i);
                    index = i;
                }
            } if(max<=split.get(i)){
                    max = split.get(i);
                    index = i;
                } max<=split.get(i) max split.get(i) split.get split i {
                    max = split.get(i);
                    index = i;
                } max = split.get(i) max split.get(i) split.get split i index = i index i split.remove(index) split.remove split index size -= 1 size 1 if(current.equals("A")){
                resultsA += max;
                current = "B";
            }else{
                resultsB += max;
                current = "A";
            } current.equals("A") current.equals current "A" {
                resultsA += max;
                current = "B";
            } resultsA += max resultsA max current = "B" current "B" {
                resultsB += max;
                current = "A";
            } resultsB += max resultsB max current = "A" current "A" max = 0 max 0 if(size==0){
                boo = false;
            } size==0 size 0 {
                boo = false;
            } boo = false boo false count = resultsA - resultsB count resultsA - resultsB resultsA resultsB System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main{
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt(); 
      
      List<Integer> split = new ArrayList<>();
        for (int i = 0; i < n; i++) {
	        int buf = sc.nextInt();
	        split.add(buf);
        }
        
        int resultsA = 0;
        int resultsB = 0;
        int max = 0;
        int index = 0;
        int size = split.size();
        String current = "A";
        int count = 0;
        Boolean boo = true;
        
        while(boo){
            for(int i = 0; i < size ; i++ ){
                if(max<=split.get(i)){
                    max = split.get(i);
                    index = i;
                }
            }
            split.remove(index);
            size -= 1;
            if(current.equals("A")){
                resultsA += max;
                current = "B";
            }else{
                resultsB += max;
                current = "A";
            }
            max = 0;
            if(size==0){
                boo = false;
            }
        }
        
        count = resultsA - resultsB;
	    
    System.out.println(count);
  }
} public class Main{
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt(); 
      
      List<Integer> split = new ArrayList<>();
        for (int i = 0; i < n; i++) {
	        int buf = sc.nextInt();
	        split.add(buf);
        }
        
        int resultsA = 0;
        int resultsB = 0;
        int max = 0;
        int index = 0;
        int size = split.size();
        String current = "A";
        int count = 0;
        Boolean boo = true;
        
        while(boo){
            for(int i = 0; i < size ; i++ ){
                if(max<=split.get(i)){
                    max = split.get(i);
                    index = i;
                }
            }
            split.remove(index);
            size -= 1;
            if(current.equals("A")){
                resultsA += max;
                current = "B";
            }else{
                resultsB += max;
                current = "A";
            }
            max = 0;
            if(size==0){
                boo = false;
            }
        }
        
        count = resultsA - resultsB;
	    
    System.out.println(count);
  }
} Main
import java.util.*;
 
public class Main{
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt(); 
      
      List<Integer> split = new ArrayList<>();
        for (int i = 0; i < n; i++) {
	        int buf = sc.nextInt();
	        split.add(buf);
        }
        
        int resultsA = 0;
        int resultsB = 0;
        int max = 0;
        int index = 0;
        int size = split.size();
        String current = "A";
        int count = 0;
        Boolean boo = true;
        
        while(boo){
            for(int i = 0; i < size ; i++ ){
                if(max<=split.get(i)){
                    max = split.get(i);
                    index = i;
                }
            }
            split.remove(index);
            size -= 1;
            if(current.equals("A")){
                resultsA += max;
                current = "B";
            }else{
                resultsB += max;
                current = "A";
            }
            max = 0;
            if(size==0){
                boo = false;
            }
        }
        
        count = resultsA - resultsB;
	    
    System.out.println(count);
  }
}
