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

// https://www.geeksforgeeks.org/longest-sub-array-with-maximum-average-value/
int maxavgsubarray(int a[],int n){
    int mx = INT_MIN;
    for(int i = 0;i < n;i++){
        if(a[i] > mx){
            mx = a[i];
        }
    }
    int i = 0;
    int ans = 1;
    int fin_ans = 1;
    while(i < n-1){
      while(i < n && a[i]  == mx && a[i+1] == a[i]){
          ans++;
          i++;
      }
      i++;
      fin_ans = max(fin_ans,ans);
      ans = 1;
    }
    return fin_ans;
}
int main(){
    int n;
    cin >> n;
    int a[n];
    for(int i = 0;i < n;i++){cin >> a[i];}
    cout << maxavgsubarray(a,n);
    return 0;
}