local n = io.read("*n") local a = {} local asum = 0 for i = 1, n do a[i] = io.read("*n") asum = asum + a[i] end if 0 <= asum then table.sort(a, function(x, y) return x > y end) else table.sort(a) end local x, y = 0, 0 for i = 1, n do if i % 2 == 1 then x = x + a[i] else y = y + a[i] end end print(math.abs(x) - math.abs(y))