Big Buckets


You have a list of nn numbers, labelled i1i_1 to ini_n, that you're trying to put inside different buckets.

Each bucket can hold any amounts of numbers in it. However, for each bucket, strictly more than half of its content must be identical.

What is the minimum number of buckets needed to pack all nn numbers?

Input

Your first line will contain the integer nn.

Your next nn lines will contain one integer each, which are the numbers waiting to be put inside buckets.

Output

One line, containing the minimum number of buckets needed to pack all nn numbers.

Constraints

  • 1≤n≤1061 \le n \le 10^{6}
  • 1≤i1...in≤1061 \le i_1 ... i_n \le 10^{6}

Python Template

Code 1
n = map(int, input.split())
numbers = [int(input()) for _ in range(n)]

Example 1

Input 1
5
4
7
4
3
2
Output 1
3
Explanation

In this scenario, the n=5n = 5 numbers can be put inside 33 buckets. One possible combination would be [2], [3], [4, 4, 7]. Each bucket has strictly more than half of the elements identical to each other.

Example 2

Input 2
8
3
5
12
3
3
5
3
4
Output 2
2
Explanation

In this scenario, the n=8n = 8 numbers can be put inside 22 buckets. One possible combination would be [3, 3, 3, 4, 12], [3, 5, 5].

Example 3

Input 3
9
6
23
6
6
6
6
6
6
6
Output 3
1
Explanation

In this scenario, all n=9n = 9 numbers can be put inside the same bucket.

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.