#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n, -1);
  long long mx = -1LL;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] > mx) mx = a[i];
  }
  long long cnt = 0, mcnt = 0;
  for (long long i = 0; i < n; i++) {
    if (a[i] == mx)
      cnt++;
    else
      cnt = 0;
    mcnt = max(mcnt, cnt);
  }
  cout << mcnt;
  return 0;
}
