fun main(args: Array<String>) {
    readLine()
    val xs = readLine()!!.split(" ").map(String::toInt).sortedDescending()
    // names _, __, ___, ..., are reserved in Kotlin v1.0.0
    val alice = xs.filterIndexed { index, v -> index % 2 == 0 }.sum()
    val bob = xs.filterIndexed { index, v -> index % 2 != 0 }.sum()
    println(alice - bob)
}