#include <bits/stdc++.h>
using namespace std;
int n, a[114514], maxn, ans, m;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    maxn = max(a[i], maxn);
  }
  for (int i = 1; i <= n; i++) {
    if (a[i] == maxn)
      m++;
    else
      m = 0;
    ans = max(ans, m);
  }
  cout << ans;
  return 0;
}
