Towers
Problem
Little Vasya has received a young builder’s kit. The kit consists of several wooden bars, the lengths of all of them are known. The bars can be put one on the top of the other if their lengths are the same.
Vasya wants to construct the minimal number of towers from the bars. Help Vasya to use the bars in the best way possible.
Input
The first line contains an integer N N N ( 1 ≤ N ≤ 1000 ) (1 ≤ N ≤ 1000) (1 ≤ N ≤ 1000) — the number of bars at Vasya’s disposal. The second line contains N space-separated integers l i l_i li — the lengths of the bars. All the lengths are natural numbers not exceeding 1000.
Output
In one line output two numbers — the height of the largest tower and their total number. Remember that Vasya should use all the bars.
Examples
Input
3
1 2 3
Output
1 3
Input
4
6 5 6 7
Output
2 3
Code
// #include <iostream>
// #include <algorithm>
// #include <cstring>
// #include <sstream>//整型转字符串
// #include <stack>//栈
// #include <deque>//堆/优先队列
// #include <queue>//队列
// #include <map>//映射
// #include <unordered_map>//哈希表
// #include <vector>//容器,存数组的数,表数组的长度
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=1e3+10;
ll a[N];
int main()
{
ll n;
cin>>n;
for(ll i=0;i<n;i++)
{
ll x;
cin>>x;
a[x]++;
}
ll mx=0,sum=0;
for(ll i=0;i<=N;i++)
{
if(a[i])
{
mx=max(mx,a[i]);
sum++;
}
}
cout<<mx<<" "<<sum<<endl;
return 0;
}