object Main {
  def main(args: Array[String]) {
    val input = io.Source.stdin.getLines().mkString("\n")
    println(kagamiMochi(input).trim())
  }

  def kagamiMochi(input: String) :String = {
    //奇数と偶数のindex
    val ziparray = input.split("\n")(1).split(" ").map(_.toInt).sorted.reverse.zipWithIndex.partition(n => n._2 % 2  ==0)
    (ziparray._1.unzip._1.sum - ziparray._2.unzip._1.sum).toString
  }

}