#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[100005];
  int max_num = 0;
  int max_cnt = 1;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    max_num = max(max_num, arr[i]);
  }
  int cnt = 1;
  for (int i = 1; i < n; i++) {
    if (arr[i] == max_num && arr[i - 1] == max_num) {
      cnt++;
    } else
      cnt = 1;
    max_cnt = max(max_cnt, cnt);
  }
  cout << max_cnt << endl;
  return 0;
}
