import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val a = (1..n).map { sc.nextInt() }.sortedDescending()
    val alice = (0 until n step 2).map { a[it] }.sum()
    val bob = a.sum() - alice
    println(alice - bob)
}