#include <bits/stdc++.h>
using namespace std;
const int N = (int)2e5 + 5;
const int inf = (int)1e9 + 7;
int n;
int a[N];
int main() {
  scanf("%d", &n);
  int mx = -1;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", a + i);
    mx = max(mx, a[i]);
  }
  int now = 0;
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    if (a[i] == mx) {
      ++now;
    } else {
      ans = max(ans, now);
      now = 0;
    }
  }
  ans = max(ans, now);
  printf("%d\n", ans);
  return 0;
}
