#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long arr[n];
  for (long long i = 0; i < n; i++) cin >> arr[i];
  int maxi = -1;
  for (int i = 0; i < n; i++) {
    if (maxi <= arr[i]) maxi = arr[i];
  }
  int length = 0;
  vector<int> vec;
  for (int i = 0; i < n; i++) {
    if (arr[i] == maxi) length++;
    if (arr[i] != maxi) {
      vec.push_back(length);
      length = 0;
    }
  }
  vec.push_back(length);
  sort(vec.rbegin(), vec.rend());
  cout << vec[0] << endl;
}
