object Main extends App {
  val n = readLine.toInt
  val arr = readLine.split(" ").map(_.toInt)
  val sorted = arr.sorted.reverse
  
  var alice = 0
  var bob = 0
  
  for (i <- 0 to n-1)
  	if (i % 2 == 0) alice += sorted(i)
  	else bob += sorted(i)
  
  println(alice - bob)
}