import sys



sys.setrecursionlimit(10 ** 7)

input = sys.stdin.readline

f_inf = float('inf')

mod = 10 ** 9 + 7





def resolve():

    n = int(eval(input()))

    A = list(map(int, input().split()))



    cnt = 0

    total = 0

    mi = f_inf

    for a in A:

        total += abs(a)

        if a < 0:

            cnt += 1

        if mi > abs(a):

            mi = abs(a)



    if cnt % 2 == 0:

        print(total)

    else:

        print((total - mi * 2))





def resolve2():

    n = int(eval(input()))

    A = list(map(int, input().split()))



    dp = [[0 for _ in range(2)] for _ in range(n + 1)]

    dp[0][1] = -f_inf

    for i in range(1, n + 1):

        dp[i][0] = max(dp[i - 1][0] + A[i - 1], dp[i - 1][1] - A[i - 1])

        dp[i][1] = max(dp[i - 1][0] - A[i - 1], dp[i - 1][1] + A[i - 1])



    print((dp[n][0]))





if __name__ == '__main__':

    resolve2()

import sys



sys.setrecursionlimit(10 ** 7)

input = sys.stdin.readline

f_inf = float('inf')

mod = 10 ** 9 + 7





def resolve():

    n = int(eval(input()))

    A = list(map(int, input().split()))

    total = 0

    mi = f_inf

    cnt_minus = 0

    for a in A:

        if a < 0:

            cnt_minus += 1

        if mi > abs(a):

            mi = abs(a)

        total += abs(a)

    print((total if cnt_minus % 2 == 0 else total - mi * 2))





if __name__ == '__main__':

    resolve()

import sys

sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7


def resolve():
    n = int(eval(input()))
    A = list(map(int, input().split()))
    cnt = 0
    total = 0
    mi = f_inf
    for a in A:
        total += abs(a)
        if a < 0:
            cnt += 1
        if mi > abs(a):
            mi = abs(a)
    if cnt % 2 == 0:
        print(total)
    else:
        print((total - mi * 2))


def resolve2():
    n = int(eval(input()))
    A = list(map(int, input().split()))
    dp = [[0 for _ in range(2)] for _ in range(n + 1)]
    dp[0][1] = -f_inf
    for i in range(1, n + 1):
        dp[i][0] = max(dp[i - 1][0] + A[i - 1], dp[i - 1][1] - A[i - 1])
        dp[i][1] = max(dp[i - 1][0] - A[i - 1], dp[i - 1][1] + A[i - 1])
    print((dp[n][0]))


if __name__ == "__main__":
    resolve2()

import sys

sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7


def resolve():
    n = int(eval(input()))
    A = list(map(int, input().split()))
    total = 0
    mi = f_inf
    cnt_minus = 0
    for a in A:
        if a < 0:
            cnt_minus += 1
        if mi > abs(a):
            mi = abs(a)
        total += abs(a)
    print((total if cnt_minus % 2 == 0 else total - mi * 2))


if __name__ == "__main__":
    resolve()

-    cnt = 0 +    cnt_minus = 0 -        total += abs(a) -            cnt += 1 +            cnt_minus += 1 -    if cnt % 2 == 0: -        print(total) -    else: -        print((total - mi * 2)) - - -def resolve2(): -    n = int(eval(input())) -    A = list(map(int, input().split())) -    dp = [[0 for _ in range(2)] for _ in range(n + 1)] -    dp[0][1] = -f_inf -    for i in range(1, n + 1): -        dp[i][0] = max(dp[i - 1][0] + A[i - 1], dp[i - 1][1] - A[i - 1]) -        dp[i][1] = max(dp[i - 1][0] - A[i - 1], dp[i - 1][1] + A[i - 1]) -    print((dp[n][0])) +        total += abs(a) +    print((total if cnt_minus % 2 == 0 else total - mi * 2)) -    resolve2() +    resolve()