#include <bits/stdc++.h>
const double eps = (1e-9);
using namespace std;
int dcmp(long double a, long double b) {
  return fabsl(a - b) <= eps ? 0 : (a > b) ? 1 : -1;
}
int getBit(int num, int idx) { return ((num >> idx) & 1) == 1; }
int setBit1(int num, int idx) { return num | (1 << idx); }
long long setBit0(long long num, int idx) { return num & ~(1ll << idx); }
long long flipBit(int num, int idx) { return num ^ (1 << idx); }
void FS() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int countNumBit1(int mask) {
  int ret = 0;
  while (mask) {
    mask &= (mask - 1);
    ++ret;
  }
  return ret;
}
const int N = 100009;
int arr[N];
int main() {
  int n;
  cin >> n;
  int mx = -1;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    if (arr[i] > mx) {
      mx = arr[i];
    }
  }
  int mxlen = 1;
  int cnt = 0, str = -1, en = 0;
  for (int i = 0; i < n; i++) {
    if (arr[i] == mx) {
      if (str == -1) str = i;
      en = i;
    } else {
      if (str != -1) mxlen = max(mxlen, en - str + 1);
      str = -1;
    }
  }
  if (str != -1) mxlen = max(mxlen, en - str + 1);
  cout << mxlen << endl;
}
