ll n,s,y[1<<17];{rd(n,y(n));sort(y,y+n);s+=abs(y[0..n-1]-y[n/2]);wt(s);}