fun main(args: Array<String>) {
    readLine()!!
    val list= readLine()!!.split(" ").map(String::toInt).toMutableList()
    list.sortDescending()
    var alice = 0
    var bob   = 0
    for(i in 0..list.count() -1) {
        if(i %2 == 0) {
            alice += list[i]
        } else if(i %2 != 0) {
            bob += list[i]
        }
    }
    print(alice - bob)
}