#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1000000+5;
int n;
ll a[N];
int main(){
freopen ("Unnamed_Problem.in","r",stdin);
freopen ("Unnamed_Problem.out","w",stdout);
scanf("%d",&n);
for (int i=1;i<=n;i++)scanf("%lld",&a[i]);
sort(a+1,a+n+1);
printf("%lld\n",min(a[1]-(a[n]*a[n])/(4*a[2]),a[2]-(a[n]*a[n])/(4*a[1])));
return 0;
}