#include <bits/stdc++.h>
using namespace std;
bool isLow(char ch) {
  if (ch >= 'a' && ch <= 'z') return true;
  return false;
}
bool isUpp(char ch) {
  if (ch >= 'A' && ch <= 'Z') return true;
  return false;
}
bool isDig(char ch) {
  if (ch >= '0' && ch <= '9') return true;
  return false;
}
int main() {
  int n, mx = -1;
  scanf("%d", &n);
  int ara[n];
  for (int i = 0; i < n; i++) scanf("%d", &ara[i]), mx = max(mx, ara[i]);
  int cnt = 1;
  for (int i = 0, j; i < n; i++)
    if (ara[i] == mx) {
      int tmp = 1;
      for (j = i + 1; j < n; j++)
        if (ara[j] == mx)
          tmp++;
        else
          break;
      cnt = max(cnt, tmp);
      i = j - 1;
    }
  printf("%d\n", cnt);
  return 0;
}
