#include <bits/stdc++.h>
using namespace std;
long long nMod = 1e9 + 7;
inline long long GCD(long long a, long long b) {
  while (b != 0) {
    long long c = a % b;
    a = b;
    b = c;
  }
  return a;
};
inline long long LCM(long long a, long long b) { return (a / GCD(a, b)) * b; };
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  int n;
  cin >> n;
  vector<int> arr(n);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  int _max = *max_element(arr.begin(), arr.end());
  int res = 1;
  int cnt = arr[0] == _max;
  for (int i = 1; i < n; i++) {
    if (arr[i] == _max) {
      cnt++;
    } else {
      cnt = 0;
    }
    res = max(res, cnt);
  }
  cout << res << endl;
  return 0;
}
