fun main(args: Array<String>) {
	val N = readLine()!!.toInt()
	var a = readLine()!!.split(" ").map(String::toInt)
	a = a.sorted()

	var Alice = 0
	var Bob = 0
	var j = 0

	for (i in (N - 1) downTo 0) {
		if (j % 2 == 0) {
			Alice += a[i]
		} else{
			Bob += a[i]
		}
		j += 1
	}
	println(Alice - Bob)
}