#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int best = 1;
  int x = *max_element(a.begin(), a.end());
  int y = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == x) {
      y++;
    } else {
      y = 0;
    }
    best = max(best, y);
  }
  cout << best << "\n";
  return 0;
}
