import numpy as np

N = int(eval(input()))

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

my_min = 10 ** 10

A_rev = []

for i in range(N - 1):

    if A[i] < 0:

        A[i] *= -1

        if i < N - 1:

            A[i + 1] *= -1

    A_rev.append(A[i])

    my_min = min(my_min, abs(A[i]))

A_rev.append(A[-1] if A[-1] >= 0 else A[-1] * -1)

my_min = min(my_min, abs(A[-1]))

if np.count_nonzero(A >= 0) == N:

    print((sum(A)))

else:

    print((sum(A_rev) - my_min * 2))
import numpy as np

N = int(eval(input()))

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

my_sum = np.sum(np.abs(A))

if np.count_nonzero(A < 0) % 2 == 0:

    print(my_sum)

else:

    print((my_sum - 2 * np.min(np.abs(A))))
import numpy as np

N = int(eval(input()))
A = np.array(list(map(int, input().split())))
my_min = 10**10
A_rev = []
for i in range(N - 1):
    if A[i] < 0:
        A[i] *= -1
        if i < N - 1:
            A[i + 1] *= -1
    A_rev.append(A[i])
    my_min = min(my_min, abs(A[i]))
A_rev.append(A[-1] if A[-1] >= 0 else A[-1] * -1)
my_min = min(my_min, abs(A[-1]))
if np.count_nonzero(A >= 0) == N:
    print((sum(A)))
else:
    print((sum(A_rev) - my_min * 2))

import numpy as np

N = int(eval(input()))
A = np.array(list(map(int, input().split())))
my_sum = np.sum(np.abs(A))
if np.count_nonzero(A < 0) % 2 == 0:
    print(my_sum)
else:
    print((my_sum - 2 * np.min(np.abs(A))))

-my_min = 10**10 -A_rev = [] -for i in range(N - 1): -    if A[i] < 0: -        A[i] *= -1 -        if i < N - 1: -            A[i + 1] *= -1 -    A_rev.append(A[i]) -    my_min = min(my_min, abs(A[i])) -A_rev.append(A[-1] if A[-1] >= 0 else A[-1] * -1) -my_min = min(my_min, abs(A[-1])) -if np.count_nonzero(A >= 0) == N: -    print((sum(A))) +my_sum = np.sum(np.abs(A)) +if np.count_nonzero(A < 0) % 2 == 0: +    print(my_sum) -    print((sum(A_rev) - my_min * 2)) +    print((my_sum - 2 * np.min(np.abs(A))))