import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); long even = 0; long odd = 0; long[] sum = new long[n]; int[] arr = new int[n]; for (int i = 0; i < n; i++) { arr[i] = sc.nextInt(); } Arrays.sort(arr); for (int i = 0; i < n; i++) { int x = arr[i]; if (i % 2 == 0) { even += x; } else { odd += x; } if (i > 0) { sum[i] = sum[i - 1] + x; } else { sum[i] = x; } } long ans = Long.MIN_VALUE; ans = Math.max(ans, Math.abs(even) - Math.abs(odd)); if (n % 2 == 0) { ans = Math.max(ans, Math.abs(odd) - Math.abs(even)); } int idx = (n - 1) / 2; ans = Math.max(ans, Math.abs(sum[idx]) - Math.abs(sum[n - 1] - sum[idx])); idx = n / 2 - 1; ans = Math.max(ans, Math.abs(sum[n - 1] - sum[idx]) - Math.abs(sum[idx])); System.out.println(ans); } static int getRate(int p, int r) { return p / 100 * (100 - r); } static int getMinus(int p, int m) { return Math.max(0, p - m); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public String nextLine() throws Exception { return br.readLine(); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }