#include <bits/stdc++.h>
using namespace std;
int n;
int arr[100005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  long long max = -1;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
    if (arr[i] >= max) {
      max = (long long)arr[i];
    }
  }
  int len, maxlen;
  maxlen = 1;
  if (arr[1] == max) {
    len = 1;
  } else {
    len = 0;
  }
  for (int i = 2; i <= n; i++) {
    if (arr[i] == max) {
      if (arr[i - 1] == max) {
        len++;
      } else {
        if (len >= maxlen) {
          maxlen = len;
        }
        len = 1;
      }
    } else {
      if (arr[i - 1] == max) {
        if (len >= maxlen) {
          maxlen = len;
        }
        len = 0;
      }
    }
  }
  if (len >= maxlen) {
    maxlen = len;
  }
  cout << maxlen << '\n';
  return 0;
}
