#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int a[maxn];
int main() {
  int n;
  int maxx = -1;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    maxx = max(maxx, a[i]);
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    int cnt = 0;
    while (a[i] == maxx && i <= n) {
      cnt++;
      i++;
    }
    ans = max(ans, cnt);
  }
  cout << ans << endl;
}
