object Main extends App {
  var a = readInt
  var b = readLine.split(" ").map(_.toInt).sorted.reverse
  var alice = 0
  for(i <- 0 until a) {
    if(i%2==0) {
      alice = alice + b(i)
    } else {
      alice = alice - b(i)
    }
  }
  print(alice)
}