#include using namespace std; using ll = long long; #define all(A) A.begin(),A.end() using vll = vector; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) using Graph = vector>; ll mod=1e9+7; ll sqrtz(ll N) { ll L = 0; ll R = sqrt(N)+10000; while (abs(R - L) > 1) { ll mid = (R +L) / 2; if (mid * mid <= N)L = mid; else R = mid; } return L; } int main() { ll N; cin>>N; vll Y(N); rep(i,N)cin>>Y[i]; sort(all(Y)); ll an=0; rep(i,N)an+=abs(Y[i]-Y[N/2]); cout<