#C6342. Maximize Equal Elements
Maximize Equal Elements
Maximize Equal Elements
You are given an array of n integers. You are allowed to perform increment operations on the elements of the array. However, note that you cannot decrease any element. The task is to determine the maximum number of elements that are already equal. In other words, find the element with the highest frequency in the array.
Formally, if the array is represented as \( a_1, a_2, \dots, a_n \), you need to find \( \max_{x} \; f(x) \) where \( f(x) \) is the frequency of \( x \) in the array.
Note: Though the problem statement mentions increment operations, the optimal strategy is to choose the element which already occurs the most times, because you cannot convert numbers greater than the chosen element to that element via increments.
inputFormat
The first line contains an integer n (the number of elements in the array). The second line contains n space-separated integers that represent the elements of the array.
\(1 \leq n \leq 10^5\)
outputFormat
Output a single integer which is the maximum frequency of any element in the array.
## sample4
1 2 2 5
2