#CCBOTPBA0000006. Số lần xuất hiện lớn nhất trong 4 mã (Maximum Frequency among Four Codes)
Số lần xuất hiện lớn nhất trong 4 mã (Maximum Frequency among Four Codes)
Maximum Frequency among Four Codes
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given n codes from 1 to 4, count each code and print the largest frequency (not the code itself). With n=0 print 0; ties do not change the answer.
Input
An integer n followed by n codes from {1,2,3,4}.
Output
Print one integer: the maximum frequency.
Subtasks
-
Subtask 1 (20%):
n ≤ 20. -
Subtask 2 (30%):
n ≤ 1000. -
Subtask 3 (50%):
n ≤ 100000.
Examples
Example 1
Input:
7
1 4 1 2 4 1 2
Output:
3
Explanation: Code 1 appears 3 times, the greatest frequency.
Example 2
Input:
0
Output:
0
Explanation: There are no codes.
Example 3
Input:
4
1 1 2 2
Output:
2
Explanation: Codes 1 and 2 are both seen twice; output the frequency 2.