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

    val x = As.filterIndexed { i, x -> i%2==0 }.sum()
    val y = As.sum() - x
    println(x - y)
}