object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val xs = List.fill(sc.nextInt())(sc.nextInt())
  val (alices, bobs) = xs.sorted.reverse.zipWithIndex.partition { case (_, i) => i % 2 == 0 }
  println(alices.map(_._1).sum - bobs.map(_._1).sum)
}
