#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int cnt, maxi, max1;
int a[N], yo;
void solve() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    maxi = max(maxi, a[i]);
  }
  for (int i = 0; i < n; i++) {
    if (a[i] == maxi) {
      cnt++;
      max1 = max(cnt, max1);
    } else
      cnt = 0;
  }
  cout << max1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t = 1;
  while (t--) solve();
  return 0;
}
