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