output_description: Print Alice's score minus Bob's score when both players take the optimal
  strategy to maximize their scores.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      a_1 a_2 a_3 ... a_N
attempt: # -*- coding: utf-8 -*-
  
  
  # 整数値入力 1文字の入力
  def input_one_number():
      return int(input())
  
  
  # 整数値龍力　複数の入力
  def input_multiple_number():
      return map(int, input().split())
  
  
  # 整数値龍力　複数の入力(配列)
  def input_multiple_number_as_list():
      return list(map(int, input().split()))
  
  
  # 2次元配列入力
  def input_map():
      return [list(map(int, list(input()))) for i in range(h)]
  
  
  # リスト出力
  def print_list(list):
      print(*list)
      return
  
  
  # 2次元配列出力
  def print_map(maplist):
      for i in maplist:
          print(*i, sep="")
      return
  
  
  # 素数生成
  def generate_primenums():
      n = 100
      primes = set(range(2, n + 1))
      for i in range(2, int(n**0.5 + 1)):
          primes.difference_update(range(i * 2, n + 1, i))
      primes = list(primes)
      return primes
  
  
  def memo():
      a = [0] * 5
      b = a  # 良くない配列のコピー
      b2 = a[:]  # 1次元のときはコピーはこれで良い
      a[1] = 3
      print("b:{}, b2:{}".format(b, b2))  # b:[0, 3, 0, 0, 0], b2:[0, 0, 0, 0, 0]
  
      import copy
  
      a = [[0] * 3 for i in range(5)]  # 2次元配列はこう準備、[[0]*3]*5だとだめ
      b = copy.deepcopy(a)  # 2次元配列はこうコピーする
  
      # 内包表記奇数のみ
      odd = [i for i in range(100) if i % 2 == 1]  # [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]
  
      # 二部探索
      import bisect
  
      a = [1, 2, 3, 5, 6, 7, 8, 9]
      b = bisect.bisect_left(a, 8)
  
      # combinations、組み合わせ、順列
      from itertools import (
          permutations,
          combinations,
          combinations_with_replacement,
          product,
      )
  
      a = ["a", "b", "C"]
      print(list(permutations(a)))
      print(list(combinations(a, 2)))
      print(list(combinations_with_replacement(a, 3)))
  
  
  # 階乗
  def kaijo(n):
      import math
  
      return math.factorial(n)
  
  
  # 選び方（コンビネーション nCr）
  def num_combination(n, r):
      import math
  
      return math.factorial(n) // math.factorial(n - r)
  
  
  # 最大公約数、最小公倍数
  def calc_gcd(a, b):
      import fractions
  
      GCD = fractions.gcd(a, b)
      lcm = a * b // gcd
      return gcd, lcm
  
  
  # 複数の最大公約数
  def calc_gcd_list(l):
      gcd = l[0]
      for i in range(1, N):
          gcd = fractions.gcd(gcd, l[i])
      return gcd
  
  
  # 各桁の和
  def sum_digit(n):
      sum = 0
      while n > 0:
          sum += n % 10
          n //= 10
      return sum
  
  
  N = input_one_number()
  lst_a = input_multiple_number_as_list()
  
  lst_a.sort(reverse=True)
  
  alice = 0
  bob = 0
  
  if len(lst_a) % 2 == 1:
      lst_a.append(0)
  
  for i in range(len(lst_a) // 2):
      alice += lst_a[i * 2]
      bob += lst_a[i * 2 + 1]
  
  print(alice - bob)
  
problem_description: Statement
  
  We have N cards. A number a_i is written on the i-th card.  
  Alice and Bob will play a game using these cards. In this game, Alice and Bob
  alternately take one card. Alice goes first.  
  The game ends when all the cards are taken by the two players, and the score
  of each player is the sum of the numbers written on the cards he/she has
  taken. When both players take the optimal strategy to maximize their scores,
  find Alice's score minus Bob's score.
samples: [{"input": "2\n    3 1", "output": "2\n    \n\nFirst, Alice will take the card with 3. Then, Bob will take the card with 1.\nThe difference of their scores will be 3 \\- 1 = 2.\n\n* * *"}, {"input": "3\n    2 7 4", "output": "5\n    \n\nFirst, Alice will take the card with 7. Then, Bob will take the card with 4.\nLastly, Alice will take the card with 2. The difference of their scores will\nbe 7 \\- 4 \\+ 2 = 5. The difference of their scores will be 3 \\- 1 = 2.\n\n* * *"}, {"input": "4\n    20 18 2 18", "output": "18"}]