import java.util.*

fun main(args: Array<String>) {
    Scanner(System.`in`).use { sc ->
        val n = sc.nextInt()
        val (a, b) = sc.asSequence().take(n).map { it.toInt() }.sortedDescending().withIndex().partition { it.index % 2 == 0 }
        println(a.map { it.value }.sum() - b.map { it.value }.sum())
    }
}
