fun main(arr:Array<String>) {
    val n = readLine()!!.toInt()
    val cards = readLine()!!.split(" ").map { it.toInt() }.sortedDescending()
    val alice = cards.indices.filter { it % 2 == 0 }.map { cards[it] }.sum()
    val bob = cards.sum() - alice
    println(alice - bob)
}