#include <bits/stdc++.h>
using namespace std;
int N;
int A[100005];
int main(int argc, char *argv[]) {
  scanf("%d", &N);
  for (int i = (1), _n = (N); i <= _n; i++) scanf("%d", &A[i]);
  int hi = -1;
  for (int i = (1), _n = (N); i <= _n; i++) hi = max(hi, A[i]);
  bool done[100005] = {false};
  int ans = 1;
  for (int i = (1), _n = (N); i <= _n; i++)
    if (A[i] == hi && done[i] == false) {
      int tans = 0;
      for (int j = (i), _n = (N); j <= _n; j++)
        if (A[j] == hi)
          done[j] = true, tans++;
        else
          break;
      ans = max(ans, tans);
    }
  printf("%d\n", ans);
  return 0;
}
