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