#include using namespace std; //#define int long long #define REP(i,m,n) for(int i=(m);i<(n);i++) #define rep(i,n) REP(i,0,n) #define pb push_back #define all(a) a.begin(),a.end() #define rall(c) (c).rbegin(),(c).rend() #define mp make_pair #define endl '\n' #define vec vector #define mat vector > #define fi first #define se second typedef long long ll; typedef unsigned long long ull; typedef pair pll; typedef long double ld; typedef complex Complex; const ll INF=1e9+7; const ll inf=INF*INF; const ll mod=998244353; const ll MAX=140010; signed main(){ ll n;cin>>n; vectorc(n); rep(i,n)cin>>c[i]; sort(rall(c)); ll ans=0; { ll sum1=0,sum2=0; rep(i,n){ if(i%2==0)sum1+=c[i]; if(i%2==1)sum2+=c[i]; } ll ans1=abs(sum1)-abs(sum2); sum1=0,sum2=0; rep(i,(n+1)/2){ sum1+=c[i]; } REP(i,(n+1)/2,n)sum2+=c[i]; ans=min(abs(sum1)-abs(sum2),ans1); } reverse(all(c)); { ll sum1=0,sum2=0; rep(i,n){ if(i%2==0)sum1+=c[i]; if(i%2==1)sum2+=c[i]; } ll ans1=abs(sum1)-abs(sum2); sum1=0,sum2=0; rep(i,(n+1)/2){ sum1+=c[i]; } REP(i,(n+1)/2,n)sum2+=c[i]; ans1=min(abs(sum1)-abs(sum2),ans1); ans=max(ans,ans1); } cout<