#C8204. Max Same Height Trees
Max Same Height Trees
Max Same Height Trees
You are given N trees, each with a specified height. However, before counting, each tree is trimmed to its nearest even number. More precisely, if a tree's height is odd, it is reduced by one (i.e. \(h\) becomes \(h-1\)); if the height is already even, it remains unchanged.
Your task is to determine the maximum number of trees that have the same height after the trimming process.
Example: If the input is 5
followed by 4 3 7 8 9
, then after trimming the heights become [4, 2, 6, 8, 8]
. Here, the height 8 appears twice, which is the maximum frequency, so the answer is 2
.
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains a single integer \(N\), the number of trees.
- The second line contains \(N\) space-separated integers representing the heights of the trees.
outputFormat
Output a single integer which is the maximum frequency of any height among the trimmed tree heights. The result should be printed to standard output (stdout).
## sample5
4 3 7 8 9
2
</p>