#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;


int main() {
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */   
    long int no, hmax;
    long int h[100000];
    long int t[10][2];
    cin>>no;
    cin>>h[0];
    hmax=h[0];
    t[0][0]=h[0];
    t[0][1]=1;
    for(int i=1; i<no; i++)
        {
            cin>>h[i];
            if(h[i]>hmax)
                {
                hmax=h[i];
                t[0][0]=h[i];
                t[0][1]=1;
            }
            else if(h[i]==t[0][0])
                {
                t[0][1]+=1;
            }
        }
    cout<<t[0][1];
    return 0;
}