#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  vector<long long int> v, v1;
  long long int n, m, k, i, t, h;
  long long int count = 1;
  cin >> t;
  for (i = 0; i < t; i++) {
    cin >> k;
    v.push_back(k);
  }
  long long int p = *std::max_element(v.begin(), v.end());
  for (h = 0; h < v.size() - 1; h++) {
    if (v[h] == p && v[h + 1] == p)
      count++;
    else {
      v1.push_back(count);
      count = 1;
    }
  }
  if (!v1.empty()) {
    long long int j = *std::max_element(v1.begin(), v1.end());
    if (j > count)
      cout << j;
    else
      cout << count;
  } else
    cout << t << endl;
  return 0;
}
