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