#include <bits/stdc++.h>
const long long int MOD = pow(10, 9) + 7;
using namespace std;
int isPrime(int n) {
  for (int i = (n - 1); i >= 2; i--) {
    if (n % i == 0) return i;
  }
  return -1;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int n;
  cin >> n;
  vector<long long int> v;
  long long int max = 0LL;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    max = (max > x ? max : x);
    v.push_back(x);
  }
  int c = 1;
  int ind = 1;
  for (int i = 0; i < (n - 1); i++) {
    if (v[i] == v[i + 1] && v[i] == max)
      ind++;
    else
      ind = 1;
    if (ind > c) {
      c = ind;
    }
  }
  cout << c;
}
