import Foundation
let rdInt = Int(readLine()!)!
let rdArr = readLine()!.split(separator: " ").map({Int($0)!}).sorted()
var aliceArr = [Int]()
var bobArr = [Int]()
for i in 1 ..< rdArr.count/2 {
    aliceArr.append(2*(i-1))
    bobArr.append(2*i-1)
    if rdArr.count.isMultiple(of: 2) {
        bobArr.removeLast()
    }
}
print(aliceArr.reduce(0, +) - bobArr.reduce(0,+))