#include <bits/stdc++.h>
using namespace std;
long long modpow(long long base, long long exp, long long modulus) {
  base %= modulus;
  long long result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulus;
    base = (base * base) % modulus;
    exp >>= 1;
  }
  return result;
}
int main() {
  long long n;
  cin >> n;
  long long a[n];
  long long mx = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    mx = max(mx, a[i]);
  }
  long long c = 1;
  long long ans = 0;
  for (long long i = 1; i < n; i++) {
    if (a[i] == a[i - 1] && a[i] == mx)
      c++;
    else {
      ans = max(c, ans);
      c = 1;
    }
  }
  ans = max(c, ans);
  cout << ans;
  return 0;
}
