#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int a[100005];
  int max_int = -1;
  int counter = 0;
  int max_counter = 0;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    if (a[i] > max_int) {
      max_int = a[i];
      max_counter = 1;
      counter = 1;
    } else if (a[i] == max_int && a[i - 1] == a[i]) {
      counter++;
    } else if (a[i] == max_int && a[i - 1] != a[i]) {
      counter = 1;
    } else {
      counter = 0;
    }
    if (counter > max_counter) max_counter = counter;
  }
  cout << max_counter;
  return 0;
}
