function Main(input){
 input = input.split("\n");
 inputStr = input[0].split(" ");
 var N = Number.parseInt(inputStr[0]);
 var A = input[1].split(" ");
 var i = 0;
 var out = 0;
 var sum = 0;
 var abssum = 0;
  
 //console.log(N);
 //console.log(A);  
  
 //文字列Aの最後と、そのひとつ前のどちらが絶対値として大きいか判定
 if ( Math.abs(Number.parseInt(A[N-1])) >= Math.abs(Number.parseInt(A[N-2]))) {
   out = N-2;
 } else {
   out = N-1;
 }
 //console.log(out);
  
 //forで回しながら絶対値を足しこむ。
 for ( i=0 ; i<N ; i++) {
   //console.log(i);
   if ( i !== out) {
     abssum = abssum + Math.abs(Number.parseInt(A[i]));
   }
   sum = abssum + Number.parseInt(A[i]);
 }
 //console.log(abssum);
 //console.log(sum);
  
 console.log(Math.max(sum,abssum));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));