#define rep(i, n) for(int i = 0; i < (int)(n); i++) typedef long long ll; #include using namespace std; int main() { ll n; std::cin >> n; vector y(n); for (int i = 0; i < n; i++) { std::cin >> y[i]; } sort(y.begin(),y.end()); if(y[0] == y[n-1]){ std::cout << 1 << std::endl; return 0; } vector sum(n+1); for (int i = 0; i < n; i++) { sum[i+1] = sum[i]+y[i]; } ll result = 1e15; for (int i = 0; i < n-1; i++) { ll dv,uv; ll m = i/2; if(i%2==0){ // 個数は奇数子。真ん中は抜く dv = sum[i+1] -sum[m+1] - sum[m]; }else{ dv = sum[i+1] -sum[m+1] -sum[m+1]; } m = (n-1-i)/2+i; // std::cout << m << std::endl; if( (n-i)%2==0 ){ uv = sum[n] - sum[m+1] - (sum[m]-sum[i+1]); }else{ uv = sum[n] - sum[m+1] - (sum[m+1]-sum[i+1]); } // std::cout << dv<<" "<