#include <bits/stdc++.h>
using namespace std;
int main() {
  int num;
  cin >> num;
  int arr[num], top = 0;
  for (int i = 0; i < num; i++) {
    cin >> arr[i];
    top = max(top, arr[i]);
  }
  int len = 1, ml = 1;
  for (int i = 1; i < num; i++) {
    if (arr[i] == top && arr[i - 1] == top) {
      len++;
      ml = max(ml, len);
    } else {
      len = 1;
    }
  }
  cout << ml;
  return 0;
}
