#K34937. Maximum Age Frequency Count
Maximum Age Frequency Count
Maximum Age Frequency Count
Given a group of N people with their respective ages, your task is to determine the maximum number of people sharing the same age. In other words, you need to compute the maximum frequency among the provided ages.
Let \( ages = [a_1, a_2, \dots, a_N] \). You are to find the value \[ \max_{x}\;f(x), \] where \( f(x) \) is the count of occurrences of age \( x \) in the list.
The solution should read input from stdin
and write the result to stdout
.
inputFormat
The first line contains an integer N (1 ≤ N ≤ 105), representing the number of people in the group. The second line contains N integers separated by spaces, where each integer represents the age of a person.
Example: 5\n10 20 20 10 10
outputFormat
Output a single integer which is the maximum number of people having the same age.
Example: 3
1
30
1