A
排个序,特判如果n==1的情况

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll>  pll;
typedef long double db;
typedef unsigned long long ull;
#define fi first
#define se second
#define pk push_back
#define mk make_pair

const ll N=1e2+10, M=(1<<20), mod=9901, inf=0x3f3f3f3f3f3f3f3f, Max=5e13;
const db esp=1e-7;

ll n, a[N];
void work(){
    scanf("%lld",&n);
    for(ll i=0;i<n;i++) scanf("%lld",&a[i]);
    sort(a,a+n,less<ll>());
    n=unique(a,a+n)-a;

    printf("%lld %lld %lld %lld",a[n-1]-a[n-2],a[n-1]-a[1],a[n-2]-a[1],a[n-2]-a[0]);
    return ;
}

int main() {
        work();
    return 0;
}