#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m = 0;
  cin >> n;
  vector<int> A(n);
  for (auto &a : A) cin >> a, m = max(m, a);
  int parc = 0, out = 0;
  for (int i = 0; i < n; i++) {
    if (A[i] == m)
      parc++;
    else
      parc = 0;
    out = max(parc, out);
  }
  cout << out << '\n';
  return 0;
}
