Polycarp has nn coins, the value of the ii-th coin is aiai. 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]a=[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 nn (1≤n≤1001≤n≤100) — the number of coins.

The second line of the input contains nn integers a1,a2,…,ana1,a2,…,an (1≤ai≤1001≤ai≤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

6
1 2 4 3 3 2

Output

2

Input

1
100

Output

1

题解:找出现重复次数最多的元素的数量即可

AC代码1:

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring> using namespace std; int main() { int n;
cin>>n;
int a[105];
for(int t=0; t<n; t++) {
scanf("%d",&a[t]);
}
sort(a,a+n);
int maxn=1;
int sum=1;
for(int t=0; t<n-1; t++) {
if(a[t]==a[t+1]) {
sum++;
} else if(a[t]!=a[t+1]) {
sum=1;
}
if(maxn<sum) {
maxn=sum;
}
}
cout<<maxn<<endl;
return 0;
}

AC代码2:

#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm> using namespace std; int main()
{ int sum[101]={0};
int n;
cin>>n;
int k;
for(int t=0;t<n;t++)
{
scanf("%d",&k);
sum[k]++;
}
int maxn=1;
for(int t=1;t<=100;t++)
{
if(sum[t]>maxn)
{
maxn=sum[t];
}
}
cout<<maxn<<endl;
return 0;
}

Polycarp's Pockets(思维)的更多相关文章

  1. 7.24-Codeforces Round #494 (Div. 3)

    链接:http://codeforces.com/contest/1003 A. Polycarp's Pockets 题型:模拟 题意:把初始集合拆分,要求相同的数不在同一个集合中,求出需要的集合个 ...

  2. Codeforces Round #494 (Div 3) (A~E)

    目录 Codeforces 1003 A.Polycarp's Pockets B.Binary String Constructing C.Intense Heat D.Coins and Quer ...

  3. CF1005D Polycarp and Div 3 思维

    Polycarp and Div 3 time limit per test 3 seconds memory limit per test 256 megabytes input standard ...

  4. CodeForces 1005D Polycarp and Div 3(思维、贪心、dp)

    http://codeforces.com/problemset/problem/1005/D  题意: 给一个仅包含数字的字符串,将字符串分割成多个片段(无前导0),求这些片段里最多有多少是3的倍数 ...

  5. cf-789A (思维)

    A. Anastasia and pebbles time limit per test 1 second memory limit per test 256 megabytes input stan ...

  6. 『ACM C++』 Codeforces | 1005D - Polycarp and Div 3

    今天佛了,魔鬼周一,在线教学,有点小累,但还好,今天AC了一道,每日一道,还好达成目标,还以为今天完不成了,最近任务越来越多,如何高效完成该好好思考一下了~最重要的还是学业的复习和预习. 今日兴趣新闻 ...

  7. [C#][算法] 用菜鸟的思维学习算法 -- 马桶排序、冒泡排序和快速排序

    用菜鸟的思维学习算法 -- 马桶排序.冒泡排序和快速排序 [博主]反骨仔 [来源]http://www.cnblogs.com/liqingwen/p/4994261.html  目录 马桶排序(令人 ...

  8. Photoshop、Illustrator思维导图笔记

    半年前学习Photoshop时记得的思维导图笔记,可能不是很全,常用的基本都记下了.

  9. CYQ.Data 从入门到放弃ORM系列:开篇:自动化框架编程思维

    前言: 随着CYQ.Data 开始回归免费使用之后,发现用户的情绪越来越激动,为了保持这持续的激动性,让我有了开源的念头. 同时,由于框架经过这5-6年来的不断演进,以前发的早期教程已经太落后了,包括 ...

随机推荐

  1. bootstrap 左右框多项选择示例

    bootstrap 左右选择框,左边框是未选项,右边框是已选择项,提供单选,全选按钮,以及取消已选项,如图示:

  2. 错误名称:Uncaught SyntaxError: Unexpected identifier

    控制台输出: 1.谷歌:Uncaught SyntaxError: Unexpected identifier 2.火狐:SyntaxError: missing ] after element li ...

  3. Anthem.NET 的回调流程图

    下面用一个最简单的 anthem:Button 回调作为例子,理清回调过程中执行函数的次序.代码如下: <%@ Page Language="C#" AutoEventWir ...

  4. 关于Snoop的用法

    snoop是开发wpf应用程序的利器.用它可以观察WPF的可视树,监听事件,更改元素属性等. 下面我介绍下snoop一些用法. 1.获取指定应用程序的UI   打开snoop,选择"Drag ...

  5. androidpn环境搭建

    1.下载androidpn版本.http://sourceforge.net/projects/androidpn/postdownload?source=dlp 2.下载安装tomcat 2.1 下 ...

  6. select元素选择时间以及jQuery对select的属性操作

    <select class="input04" id="1" name="in_class1" onchange="setc ...

  7. Spring之2:Spring Bean动态注册、删除

    IoC容器的初始化包括BeanDefinition的Resource定位.载入和注册这三个基本的过程. 一.Resource定位.BeanDefinition的资源定位有resourceLoader通 ...

  8. C#使用NPOI将DataGridView内数据写入电子表格Excel

    NPOI能够在用户没有安装office的情况下读写office文件,包括.xls/.doc/.ppt等类型的文件.本文介绍的是使用NPOI库内的函数读写Excel(.xls)内的内容.在使用NPOI之 ...

  9. JavaScript之JMap

    在JavaScript中我们利用function类定义类在类的内部我们用var 定义私有变量 私有函数在类的内部我们用this 定义公有变量(1)定义一个类 function JMap() { var ...

  10. 问题:request.Headers;结果:HttpWebRequest.Headers 属性

    指定构成 HTTP 标头的名称/值对的集合. Headers 集合包含与请求关联的协议标头.下表列出了由系统或由属性或方法设置但未存储在 Headers 中的 HTTP 标头.   标头 设置方 Ac ...