# coding: UTF-8

import sys

#sys.setrecursionlimit(n)

import heapq

import re

import bisect

import random

import math

import itertools

from collections import defaultdict, deque

from copy import deepcopy

from decimal import *



n = int(eval(input()))

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



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

dp[0][1] = float('inf') * -1



for i in range(n):

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

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

print((dp[n][0]))
# coding: UTF-8

import sys

#sys.setrecursionlimit(n)

import heapq

import re

import bisect

import random

import math

import itertools

from collections import defaultdict, deque

from copy import deepcopy

from decimal import *



n = int(eval(input()))

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



count = 0

s = 0

b = []

for i in range(n):

    count += 1 if a[i] < 0 else 0

    b.append(abs(a[i]))

flg = False

if count % 2 == 1:

    flg = True

ans = sum(b)

if flg:

    ans -= min(b) * 2

print(ans)
# coding: UTF-8
import sys

# sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

n = int(eval(input()))
a = list(map(int, input().split()))
dp = [[0 for i in range(2)] for i in range(n + 1)]
dp[0][1] = float("inf") * -1
for i in range(n):
    dp[i + 1][0] = max(dp[i][0] + a[i], dp[i][1] - a[i])
    dp[i + 1][1] = max(dp[i][0] - a[i], dp[i][1] + a[i])
print((dp[n][0]))

# coding: UTF-8
import sys

# sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

n = int(eval(input()))
a = list(map(int, input().split()))
count = 0
s = 0
b = []
for i in range(n):
    count += 1 if a[i] < 0 else 0
    b.append(abs(a[i]))
flg = False
if count % 2 == 1:
    flg = True
ans = sum(b)
if flg:
    ans -= min(b) * 2
print(ans)

-dp = [[0 for i in range(2)] for i in range(n + 1)] -dp[0][1] = float("inf") * -1 +count = 0 +s = 0 +b = [] -    dp[i + 1][0] = max(dp[i][0] + a[i], dp[i][1] - a[i]) -    dp[i + 1][1] = max(dp[i][0] - a[i], dp[i][1] + a[i]) -print((dp[n][0])) +    count += 1 if a[i] < 0 else 0 +    b.append(abs(a[i])) +flg = False +if count % 2 == 1: +    flg = True +ans = sum(b) +if flg: +    ans -= min(b) * 2 +print(ans)