#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> X;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    X.push_back(x);
  }
  int m = 0;
  for (int i = 0; i < n; i++) {
    if (X[i] > m) m = X[i];
  }
  int c = 0, l = 0;
  for (int i = 0; i < n; i++) {
    if (X[i] == m)
      c += 1;
    else
      c = 0;
    l = max(c, l);
  }
  cout << l;
  return 0;
}
