1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include <cassert>
#include <iostream>
#include <istream>
#include <fstream>
#include <algorithm>
#include <cstdio>
#include <complex>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <string>
#include <cstdlib>
#include <memory>
#include <ctime>
#include <bitset>
#include <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <ranges>

using namespace std;

class Lid2024
{
	long n;
	vector<int> input;

public:

	void virtual Solve()
	{
		cin >> n;

		input = vector<int>(n, 0);

		set<int> set;
		map<int, int> map;
		
		for (int i = 0; i < n; i++) {
			cin >> input[i];
		}

		for (int i = 0; i < n; i++) {

			int elem_i = input[i];
			set.insert(elem_i);

			if (map.find(elem_i) == map.end()) {
				map[elem_i] = 1;
			}
			else {
				map[elem_i]++;
			}
		}

		long total = 0;
		int res = 0;

		vector<int> vec;
		for (const auto& pair : map) {
			vec.push_back(pair.second);
		}

		std::sort(vec.begin(), vec.end(), std::greater<int>());

		int all = n;

		for (int i = 0; i < n; i++) {
			total = vec[i];

			res++;
			if (total > all / 2) {
				break;
			}

			all -= (vec[i] + vec[i] - 1);;
		}

		std::cout << res << std::endl;

	}
};

int main()
{
	Lid2024* p = new Lid2024();
	p->Solve();
	delete p;
	return 0;
}