#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, i;
  cin >> n;
  vector<long long> a(n);
  for (i = 0; i < n; i++) cin >> a[i];
  long long d = *(max_element(a.begin(), a.end()));
  long long ans = 0;
  long long ct = 0;
  for (i = 0; i < n; i++) {
    if (a[i] == d) {
      ct++;
    } else
      ct = 0;
    ans = max(ct, ans);
  }
  cout << ans << endl;
}
