#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int N = 1e5 + 4;
using namespace std;
int main() {
  long long n, max = -1, count, maxcount = 0;
  scanf("%lld", &n);
  long long arr[n];
  for (int i = 0; i < n; i++) {
    scanf("%lld", &arr[i]);
    if (arr[i] > max) {
      max = arr[i];
      maxcount = count = 1;
    } else if (arr[i] == max) {
      count++;
      if (count > maxcount) maxcount = count;
    } else {
      count = 0;
    }
  }
  printf("%lld", maxcount);
  return 0;
}
