#include<bits/stdc++.h>
using namespace std;
using ll = long long;
//using LL = __int128
#define pi pair<ll, ll>
#define fi first
#define se second
#define N 111111
#define inf 0x3f3f3f3f3f3f3f3f
ll n, a[N], vis[11], res[5];
void upd(ll &x, int t, ll v){
	if(t)
		x = max(x, v);
	else
		x = min(x, v);
}
bool check(){
	for(int i = 2 ; i <= n ; i++)
		if(a[i] * a[i - 1] <= 0)
			return false;
	return true;
}
int main(){
	freopen("game.in", "r", stdin);
	freopen("game.out", "w", stdout);
	scanf("%lld", &n);
	for(int i = 1 ; i <= n ; i++)
		scanf("%lld", a + i);
	if(check()){
		for(int i = 1 ; i <= n ; i++)
			a[i] = abs(a[i]);
		sort(a + 1, a + 1 + n, greater<ll>());
		ll ans[2] = {0};
		for(int i = 1 ; i <= n ; i++)
			ans[i & 1] += a[i];
		printf("%lld", ans[1] - ans[0]);
		return 0;
	}
	sort(a + 1, a + 1 + n);
	ll ans[2] = {0};
	for(int i = 1 ; i <= n ; i++)
		ans[i & 1] += a[i];
	res[1] = abs(ans[1]) - abs(ans[0]);
	memset(ans, 0, sizeof ans);
	for(int i = n ; i >= 1 ; i--)
		ans[i & 1] += a[i];
	res[2] = abs(ans[n & 1]) - abs(ans[(n ^ 1) & 1]);
	memset(ans, 0, sizeof ans);
	for(int i = n / 2 ; i >= 1 ; i--)
		ans[1] += a[i];
	for(int i = n / 2 + 1 ; i <= n ; i++)
		ans[0] += a[i];
	res[3] = abs(ans[0]) - abs(ans[1]);
	memset(ans, 0, sizeof ans);
	for(int i = n - n / 2 ; i >= 1 ; i--)
		ans[0] += a[i];
	for(int i = n - n / 2 + 1 ; i <= n ; i++)
		ans[1] += a[i];
	res[4] = abs(ans[0]) - abs(ans[1]);
	cerr << res[1] << " " << res[2] << " " << res[3] << " " << res[4] << "\n";
	printf("%lld", max(min(res[2], res[3]), min(res[1], res[4])));
	return 0;
}
/*

*/