#include #include void solve() { int n; std::cin >> n; n *= 2; std::multiset org; while (n--) { int x; std::cin >> x; org.insert(x); } // Dry { auto s = org; int cnt = 0; auto it = s.begin(); while (it != s.end()) { auto x = *it; it = s.erase(it); // x + y < 0 <-> y < -x auto nit = s.lower_bound(-x); if (nit == s.begin()) continue; ++cnt; --nit; if (it == nit) { it = s.erase(nit); } else { s.erase(nit); } } std::cout << cnt << " "; } // Wet { auto s = org; int cnt = 0; auto it = s.begin(); while (it != s.end()) { auto x = *it; it = s.erase(it); // x + y > 0 <-> y > -x auto nit = s.upper_bound(-x); if (nit == s.end()) continue; ++cnt; if (it == nit) { it = s.erase(nit); } else { s.erase(nit); } } std::cout << cnt << " "; } // Moist { auto s = org; int cnt = 0; auto it = s.begin(); while (it != s.end()) { auto x = *it; it = s.erase(it); // x + y = 0 <-> y = -x auto nit = s.find(-x); if (nit == s.end()) continue; ++cnt; if (it == nit) { it = s.erase(nit); } else { s.erase(nit); } } std::cout << cnt << "\n"; } } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }