import java.io.InputStream
import java.io.PrintStream
import java.util.*

class Abc088B(
    val input: InputStream,
    val output: PrintStream
) {
    /**
     * 大きいものから順に取るだけ
     */
    fun proc() {
        val sc = Scanner(input)
        val n = sc.nextInt()
        val input = generateSequence { sc.nextInt() }
            .take(n).toList().sortedDescending()

        var alice = 0
        var bob = 0
        for ((i, v) in input.withIndex()) {
            if (i % 2 == 0) {
                alice += v
            } else {
                bob += v
            }
        }
        output.print(alice - bob)
    }
}

fun main(args: Array<String>) {
    Abc088B(System.`in`, System.out).proc()
}
