import scala.io.StdIn._
object Main{
  def main(args:Array[String]){
    val N = readInt
    val a = readLine.split(' ').map(x=>x.toInt).sorted.reverse
    val sum = a.sum
    var x = 0;
    for(i <- 0 until N if i%2==0){
      x += a(i)
    }
    val y = sum - x
    println(x-y)
  }
}
