program ABC_088_B_CardGameforTwo
   implicit none 
   integer i, m, N, am, countA, countB
   integer(8), allocatable :: a(:)
   read(*, *) N
   allocate (a(1:2*N))
   a(:) = 0
   read(*, *) a(1:N)
   do i = 1, N - 1
      am = maxval(a(i+1:N))
	  m  = maxloc(a(i+1:N), 1) + i
	  if (a(i) < am) then
	      a(m) = a(i)
		  a(i) = am
	  end if
   end do
   countA = 0
   countB = 0
   do i = 1, N
      countA = countA + a(2 * i -1 )
	  countB = countB + a(2 * i)
   end do
   write(*, *)countA-countB
end program ABC_088_B_CardGameforTwo  