Algorithm


A. Polycarp's Pockets
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Polycarp has n coins, the value of the i-th coin is ai��. Polycarp wants to distribute all the coins between his pockets, but he cannot put two coins with the same value into the same pocket.

For example, if Polycarp has got six coins represented as an array a=[1,2,4,3,3,2]�=[1,2,4,3,3,2], he can distribute the coins into two pockets as follows: [1,2,3],[2,3,4][1,2,3],[2,3,4].

Polycarp wants to distribute all the coins with the minimum number of used pockets. Help him to do that.

Input

The first line of the input contains one integer n (1n1001≤�≤100) — the number of coins.

The second line of the input contains n integers a1,a2,,an�1,�2,…,�� (1ai1001≤��≤100) — values of coins.

Output

Print only one integer — the minimum number of pockets Polycarp needs to distribute all the coins so no two coins with the same value are put into the same pocket.

Examples
input
Copy
6
1 2 4 3 3 2
output
Copy
2
input
Copy
1
100
output
Copy
1

 



 

Code Examples

#1 Code Example with C++ Programming

Code - C++ Programming

#include <bits/stdc++.h>

using namespace std;

int n, a[101];
set<int> st;

int main() {
  int cnt = 0;
  cin >> n;
  for(int i = 0; i < n; ++i)
    cin >> a[i];

  int res = 0;
  while(cnt != n) {
    st.clear();
    for(int i = 0; i < n; ++i)
      if(a[i] != -1 && st.count(a[i]) == 0)
        st.insert(a[i]), a[i] = -1, ++cnt;
    ++res;
  }

  cout << res << endl;

  return 0;
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
6
1 2 4 3 3 2

Output

x
+
cmd
2
Advertisements

Demonstration


Codeforces Solution-A. Polycarp's Pockets-Solution in C, C++, Java, Python

Previous
Codeforces solution 1080-B-B. Margarite and the best present codeforces solution
Next
CodeChef solution DETSCORE - Determine the Score CodeChef solution C,C+