#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const long long int INF = 9e18 + 2e17;
const int inf = 2e9;
const int N = 1e5 + 22;
const double eps = 1e-10;
const double PI = 3.14159265;
int n, m, a[N];
void _solve() {
  cin >> n;
  for (int i = (int)0; i < (int)n; i++) cin >> a[i];
  int mx = *max_element(a, a + n);
  int ans = 1, i = 0;
  while (i < n) {
    if (a[i] != mx) {
      i++;
      continue;
    }
    int cnt = 0;
    while (i < n && a[i] == mx) cnt++, i++;
    ans = max(ans, cnt);
  }
  cout << ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  _solve();
  return 0;
}
