#include <bits/stdc++.h>
using namespace std;
int main() {
  long int n;
  long int m = 0, s = 0, p = 0;
  cin >> n;
  long long int v[n];
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    if (m < v[i]) m = v[i];
  }
  for (int i = 0; i < n; i++) {
    if (v[i] == m) {
      p++;
    } else
      p = 0;
    if (s < p) {
      s = p;
    }
  }
  cout << s;
  return 0;
}
