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