gia nhu dstt cung de

 avatar
NguyenAnhQuan
c_cpp
a year ago
567 B
3
Indexable
#include <bits/stdc++.h>

#define ll long long
#define LIM 1000005
#define X first
#define Y second
#define EL cout<<"\n"

using namespace std;

int a[LIM];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  	
  	int n; cin >> n;

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

  	int mx = 0, cnt = 0;

  	for (int i = 0; i < n; i++)
  		if (a[i] > mx) 
  		{
  			mx = a[i]; cnt = 1;
  		}
  		else if (a[i] == mx)
  		{
  			cnt++;
  		}

  	cout << mx << "\n" << cnt;

   

    return 0;
}