object Main extends App{
    val n = scala.io.StdIn.readInt
    val a = scala.io.StdIn.readLine.split(" ").map(_.toInt).sorted.reverse
    println((0 to n-1 by 2).map(a(_)).sum - (1 until n by 2).map(a(_)).sum)
}