#include <bits/stdc++.h>
using namespace std;
int n;
int a[100005];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  int maxx = -1, maxs = -1;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    maxx = max(maxx, a[i]);
  }
  int sum = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == maxx) {
      sum++;
      maxs = max(maxs, sum);
    } else {
      sum = 0;
    }
  }
  cout << maxs << endl;
  return 0;
}
