#include <bits/stdc++.h>
using namespace std;
long long c, m;
int main() {
  long long n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; ++i) cin >> a[i];
  long long ma = *max_element(a, a + n);
  for (int i = 0; i < n; ++i) {
    if (a[i] == ma && c) {
      c++;
    } else {
      if (a[i] == ma) {
        c++;
      } else {
        m = max(m, c);
        c = 0;
      }
    }
  }
  m = max(m, c);
  cout << m;
}
