#include <bits/stdc++.h>
using namespace std;
map<long long, long long> mp, mp1;
map<long long, long long>::iterator itr;
int main() {
  long long t, n;
  scanf("%lld", &n);
  long long a[n];
  long long mx = -1;
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
    mx = max(mx, a[i]);
  }
  long long cnt = 0, tmp = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == mx) {
      cnt++;
      tmp = max(tmp, cnt);
    } else {
      cnt = 0;
    }
  }
  cout << tmp << endl;
  return 0;
}
