import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

immutable long MOD = 10^^9 + 7;
immutable long INF = 1L << 59;

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!long).array;

    if (N == 1) {
        writeln(A[0]);
        return;
    }

    long S = A.map!(a => abs(a)).sum;
    long ans = -INF;

    foreach (i; 0..N-1) {
        auto sub = abs(A[i] - A[i+1]);
        ans = max(ans, S - abs(A[i]) - abs(A[i+1]) + sub);
    }

    ans.writeln;
}
