input = readlines
n = input[0].to_i
dish_rates = input[1..-1].map{|element| element.chomp.split(' ').map(&:to_i)}.sort_by{|e| e.inject(:+)}.reverse
puts (0..n - 1).select{|i| i % 2 == 0}.map{|i| dish_rates[i][0]}.inject(:+) - (0..n - 1).select{|i| i % 2 == 1}.map{|i| dish_rates[i][1]}.inject(:+)

