#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  int n;
  cin >> n;
  int a[n];
  int maxx = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    maxx = max(maxx, a[i]);
  }
  int l = 0, maxl = 0;
  ;
  for (int i = 0; i < n; i++) {
    if (a[i] != maxx) {
      maxl = max(maxl, l);
      l = 0;
    } else {
      l++;
    }
  }
  maxl = max(maxl, l);
  cout << maxl << endl;
  return 0;
}
