n = gets.to_i
a =[]
b =[]
c =[]
n.times do
    aa,bb = gets.split(" ").map(&:to_i)
    a << aa
    b << bb
    c << (aa + bb)
end
ans = 0
c.sort!
for i in 0 ..n-1 do
    if i%2 == 0
        ans += c[i]
    end
end

puts ans - b.inject(:+)