#include <bits/stdc++.h>
using namespace std;
int n, a[100005], mx, ct, ans;
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    mx = max(mx, a[i]);
  }
  for (int i = 1; i <= n; i++) {
    if (a[i] == mx) {
      ct++;
      ans = max(ans, ct);
    } else
      ct = 0;
  }
  cout << ans << "\n";
  return 0;
}
