#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  vector<long long int> v(n), vv;
  for (int i = 0; i < n; i++) cin >> v[i];
  long long int mx = *max_element(v.begin(), v.end());
  int len = 0, fg = 0;
  for (long long int i = 0; i < n; i++) {
    if (v[i] == mx) {
      long long int j = i;
      while (v[j] == mx && j <= n - 1) j++;
      vv.push_back(j - i);
      i = j;
    }
  }
  sort(vv.begin(), vv.end());
  cout << vv[vv.size() - 1];
  return 0;
}
