import java.util.Scanner; public class Test3 { public static void main(String[] args) {
        Scanner scan=new Scanner(System.in); int n = scan.nextInt(); long[] arr=new long[n]; int a1=0,a2=0,a3=0; long min=2147483647; long sum=0; for(int i=0;i<n;i++){
            arr[i]=scan.nextLong(); if(arr[i]>0){
                a1=1;
            }else if(arr[i]<0){
                a2=1;
            }else if(arr[i]==0){
                a3=1;
            } if(min>arr[i]){
                min=arr[i];
            }
            sum=sum+Math.abs(arr[i]);
        } if(a3==1){
            System.out.println(sum); return;
        } if(a1!=1||a2!=1){
            sum=sum-Math.abs(min*2);
        }
        System.out.println(sum);
    }
}