#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18 + 239;
vector<long long> used;
vector<vector<pair<long long, long long> > > gr;
long long ans = -inf;
vector<long long> dp;
long long n;
void dfs(long long p1) {
  used[p1] = 1;
  if (gr[p1].size() == 1 && p1 != 0) {
    ans = max(ans, dp[p1]);
    return;
  }
  vector<long long> neib;
  for (long long i = 0; i < gr[p1].size(); i++) {
    long long p2 = gr[p1][i].first;
    if (used[p2] == 1) continue;
    dfs(p2);
    neib.push_back(dp[p2] - gr[p1][i].second);
  }
  sort(neib.rbegin(), neib.rend());
  if (neib.size() > 1) {
    ans = max(ans, dp[p1] + neib[0] + neib[1]);
  }
  dp[p1] = max(dp[p1], dp[p1] + neib[0]);
  ans = max(ans, dp[p1]);
}
signed main() {
  cin >> n;
  vector<long long> val(n, 0);
  for (long long i = 0; i < n; i++) cin >> val[i];
  long long mx = -1;
  for (long long i = 0; i < n; i++) mx = max(mx, val[i]);
  long long cnt = 0, ana = 1;
  for (long long i = 0; i < n; i++) {
    if (val[i] == mx)
      ++cnt;
    else
      cnt = 0;
    ana = max(ana, cnt);
  }
  cout << ana << endl;
}
