N = gets.to_i
A = gets.split(' ').map{|x| x.to_i}
s = 0
for x in A
  s = s + x.abs
end

l = Array.new(N)
r = Array.new(N)

l[0] = false
for i in 0...N-1
  l[i+1] = (A[i] < 0 && !l[i]) || (A[i] > 0 && l[i])? true : false
end

r[N-1] = false
for j in 0...N-1
  i = N - j - 1
  r[i-1] = (A[i] < 0 && !r[i]) || (A[i] > 0 && r[i])? true : false
end

ans = -10000000000000000000
for i in 0...N
  f = l[i] != r[i]? true : false
  if (A[i] < 0 && f == true) || (A[i] > 0 && f == false)
    ans = s
  else
    ans = [ans, s - 2 * A[i].abs].max
  end
end

p ans
  
