object Main extends App {
	val n = scala.io.StdIn.readInt
	val a = scala.io.StdIn.readLine.split(" ").map(_.toInt).sorted.reverse

	var re = 0

	for(i<-0 until n by +2){
		re += a(i)
	}

	val sum = a.sum
	println(2*re - sum)

}