#include <bits/stdc++.h> using namespace std; // A集合中尽量取最大的数! // B集合中尽量取最小的数! int main(){ int n; cin >> n; vector<long long> arr(n); for(int i = 0; i < n; i++){ cin >> arr[i]; } sort(arr.begin(),arr.end()); vector<long long> pre_sum{0},suffix_sum{0}; for(int i = 0; i < n; i++){ pre_sum.push_back(pre_sum.back() + arr[i]); } for(int i = n-1; i >= 0; i--){ suffix_sum.push_back(suffix_sum.back() + arr[i]); } // 枚举K int ans = -1; for(int k = 1; 2*k+1 <= n; k++){ long long blue_sum = pre_sum[k+1]; long long red_sum = suffix_sum[k]; if(blue_sum < red_sum){ ans = k; break; } } cout << ans << endl; return 0; }