object Main extends App {
  val N = readInt
  val line = readLine
  val a = line.split(" ").map(_.toInt)
  val sorted = a.sorted
  val alice = sorted.zipWithIndex.filter(_._2 % 2 == 0).map(_._1).sum
  val bob = sorted.zipWithIndex.filter(_._2 % 2 == 1).map(_._1).sum
  println(alice-bob)
}
