#include <bits/stdc++.h>
using namespace std;
int n, ans, Max, an, x;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    if (Max < x) {
      Max = x;
      ans = 0;
      an = 0;
    }
    if (x == Max)
      an++;
    else
      an = 0;
    ans = max(ans, an);
  }
  printf("%d", ans);
}
