#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<vector>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define FOR(i,s,e) for (int i=s;i<e;i++)
#define FOE(i,s,e) for (int i=s;i<=e;i++)
#define FOD(i,s,e) for (int i=s;i>=e;i--)
#define SET(a,e) memset(a,e,sizeof(a))
#define LL long long
#define LD long double
#define pb push_back
#define x first
#define y second
#define PII pair<int,int>
#define PLI pair<LL,int>
int n,a[100055];
bool v[100055];
int best(int x) {
if (x == n-1) {
int p = 0;
FOR(i,0,n) if (!v[i]) {
p = a[i];
break;
}
FOD(i,n-1,0) if (!v[i])
return a[i] - p;
}
if (x & 1) {
int ret = 1000000000;
FOR(i,0,n) if (!v[i]) {
v[i] = 1;
ret = min(ret,best(x+1));
v[i] = 0;
}
return ret;
}
else {
int ret = 0;
FOR(i,0,n) if (!v[i]) {
v[i] = 1;
ret = max(ret,best(x+1));
v[i] = 0;
}
return ret;
}
}
int main () {
scanf("%d",&n);
FOR(i,0,n) scanf("%d",a+i);
sort(a,a+n);
printf("%d\n",best(1));
return 0;
}
I2luY2x1ZGU8Y3N0ZGlvPgojaW5jbHVkZTxjc3RkbGliPgojaW5jbHVkZTxjc3RyaW5nPgojaW5jbHVkZTxhbGdvcml0aG0+CiNpbmNsdWRlPGNtYXRoPgojaW5jbHVkZTxjdGltZT4KI2luY2x1ZGU8dmVjdG9yPgojaW5jbHVkZTxxdWV1ZT4KI2luY2x1ZGU8c3RhY2s+CiNpbmNsdWRlPG1hcD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2RlZmluZSBGT1IoaSxzLGUpIGZvciAoaW50IGk9cztpPGU7aSsrKQojZGVmaW5lIEZPRShpLHMsZSkgZm9yIChpbnQgaT1zO2k8PWU7aSsrKQojZGVmaW5lIEZPRChpLHMsZSkgZm9yIChpbnQgaT1zO2k+PWU7aS0tKQojZGVmaW5lIFNFVChhLGUpIG1lbXNldChhLGUsc2l6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