#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long max_avg = -1;
  long long max_len = -1;
  long long curr_len = 0;
  std::vector<long long> input;
  for (long long i = 0; i < n; i++) {
    long long temp;
    cin >> temp;
    input.push_back(temp);
    if (temp > max_avg) {
      max_avg = temp;
      curr_len = 1;
      max_len = 1;
    } else if (temp == max_avg && temp == input[i - 1]) {
      curr_len++;
      if (curr_len > max_len) max_len = curr_len;
    } else if (temp == max_avg && temp != input[i - 1]) {
      curr_len = 1;
    }
  }
  cout << max_len;
  return 0;
}
