#include #define ll long long using namespace std; ll y[100001], d[100001]; int main(){ int n; cin>>n; for(int i=0;i>y[i]; sort(y, y+n); ll t=0; for(int i=0;i=0;i--){ t += y[n-(n-i)/2] - y[i+1]; d[i] += t; } ll m=1e18; for(int i=0;i