import scala.io.{StdIn => in}

object Main extends App {
  val n = in.readInt
  val a = in.readLine.split(" ").map(_.toInt).sorted(Ordering[Int].reverse)

  val alice = a.indices.withFilter(_ % 2 == 0).map(a(_)).sum
  val bob = a.indices.withFilter(_ % 2 == 1).map(a(_)).sum
  val ans = alice - bob
  println(ans)
}