#include #include #define ll long long using namespace std; ll y[100001], dp[100001]; int main(){ int n; cin>>n; ll ans; for(int i=0;i>y[i]; sort(y, y+n); if(n==2){ ans=y[1]-y[0]; }else if(n==3){ ans=y[2]-y[0]; }else{ dp[0]=1e18; dp[1]=y[1]-y[0]; dp[2]=y[2]-y[0]; for(int i=3;i