A - Polycarp's Pockets

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]

, he can distribute the coins into two pockets as follows: [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

( 1n100

) — the number of coins.

The second line of the input contains n

integers a1,a2,,an ( 1ai100

) — 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
6
1 2 4 3 3 2
Output
2
Input
1
100
Output
1


AC代码(查找重复次数最多的数即可)

#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int a[120], i, n, x;
    while(scanf("%d",&n)!=EOF)
    {
     memset(a, 0, sizeof(a));
     for(i = 0;i<n;i++)
     {
      scanf("%d",&x);
      a[x]++;
     }
     int maxi = 0;
     for(i = 1;i<120;i++)
     {
      if(a[i]>maxi)
      {
       maxi = a[i];
      }
     }
     printf("%d\n",maxi);
    }
    return 0;
}

猜你喜欢

转载自blog.csdn.net/qq_41524782/article/details/80954740