#include <bits/stdc++.h>
using namespace std;
int a[300005];
int main() {
  int n;
  cin >> n;
  int mx = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
    mx = max(mx, a[i]);
  }
  int cnt = 0, mxcnt = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == mx)
      cnt++, mxcnt = max(cnt, mxcnt);
    else
      cnt = 0;
  }
  cout << mxcnt << endl;
}
