fun main(args: Array<String>) {
    val a = readLine()!!.toInt()
    val n = readLine()!!.split(" ").map(String::toInt).sorted().reversed()
    var alice = 0
    var bob = 0
    for(i in 0 until a){
        if(i % 2 == 0){
            alice += n[i]
        }else{
            bob += n[i]
        }
    }
    println(alice - bob)

}

