#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char* argv[]) {
  long long max = -1;
  long long maxLen = -1;
  long long current = 0;
  long long size;
  long long temp;
  cin >> size;
  for (long long i = 0; i <= size - 1; i++) {
    cin >> temp;
    if (temp > max) {
      max = temp;
      maxLen = -1;
      current = 1;
    } else if (temp < max) {
      if (current > maxLen) maxLen = current;
      current = 0;
    } else if (temp == max) {
      current++;
    }
  }
  if (current > maxLen) maxLen = current;
  cout << maxLen << endl;
  return 0;
}
