lib C fun strtoll(s : UInt8*, p : UInt8**, b : Int32) : Int64 end class String def to_i64 C.strtoll(self, nil, 10) end end def solve(a) s = [0i64, 0i64] i = 0 until a.empty? s[i % 2] += a.pop i += 1 end s[0].abs - s[1].abs end n = read_line.to_i a = read_line.split.map(&.to_i64) a.map! { |i| -i } if a.sum < 0 a.sort! puts solve(a)