#include <bits/stdc++.h>
using namespace std;
void test() {
  int n;
  cin >> n;
  vector<int> a;
  int maximum = INT32_MIN;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a.push_back(x);
    maximum = max(maximum, a[i]);
  }
  int ans = 0;
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == maximum) {
      count++;
    } else {
      ans = max(ans, count);
      count = 0;
    }
  }
  ans = max(ans, count);
  cout << ans << endl;
}
int main() { test(); }
