#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long n, a[100009], m = 0;
  cin >> n;
  for (long i = long(0); i < long(n); i++) {
    cin >> a[i];
    m = max(m, a[i]);
  }
  long c = 0, q = 0;
  for (long i = long(0); i < long(n); i++) {
    if (a[i] == m)
      c++;
    else {
      q = max(q, c);
      c = 0;
    }
  }
  q = max(q, c);
  cout << q << "\n";
}
