#include #include #include #include #include #include #include using namespace std; const int NUM_MAX = 1e5; int calc(priority_queue que1, priority_queue que2, int zeros) { int n_one = 0; int n_half = 0; for (int i = 0; i < zeros; i++) { que1.push(0); } int val1, val2; while (!que1.empty()) { val1 = que1.top(); que1.pop(); val2 = NUM_MAX * 10; while (!que2.empty()) { val2 = que2.top(); que2.pop(); if (val1 > val2) { break; } } if (val1 > val2) { n_one++; } else { n_half++; } } n_one += n_half / 2; return n_one; } int main() { int n, n2, a; cin >> n; n2 = n * 2; vector v_plus, v_minus; v_plus.assign(NUM_MAX + 1, 0); v_minus.assign(NUM_MAX + 1, 0); priority_queue q_plus, q_minus; int zeros = 0; for (int i = 0; i < n2; i++) { cin >> a; if (a > 0) { q_plus.push(a); v_plus[a]++; } else if (a < 0) { a *= -1; q_minus.push(a); v_minus[a]++; } else { zeros++; } } int n_plus = calc(q_plus, q_minus, zeros); int n_minus = calc(q_minus, q_plus, zeros); int n_zero = zeros; for (int i = 1; i <= NUM_MAX; i++) { n_zero += min(v_plus[i], v_minus[i]); } cout << n_minus << " " << n_plus << " " << n_zero << endl; return 0; }