#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int a[n];
  long long int ma = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    ma = max(ma, a[i]);
  }
  int c = 0;
  int an = 0;
  for (int i = 0; i < n; ++i) {
    if (a[i] == ma)
      c++;
    else
      c = 0;
    an = max(an, c);
  }
  cout << an;
}
