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