#include <bits/stdc++.h>
using namespace std;
const long long N = 5e5 + 1, M = 1e9 + 7;
signed main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<long long> a(n);
  long long maximum = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    maximum = max(maximum, a[i]);
  }
  vector<pair<long long, long long> > c;
  c.push_back(make_pair(a[0], 1));
  for (long long i = 1; i < n; i++) {
    if (a[i] == a[i - 1]) {
      c[(long long)c.size() - 1].second++;
    } else {
      c.push_back(make_pair(a[i], 1));
    }
  }
  long long ans = 0;
  for (long long i = 0; i < (long long)c.size(); i++) {
    if (c[i].first == maximum) {
      ans = max(ans, c[i].second);
    }
  }
  cout << ans;
  return 0;
}
