#include <bits/stdc++.h>
using namespace std;
bool isPrime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  std::cout.precision(12);
  int n;
  cin >> n;
  int a[n];
  int ma = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    ma = max(a[i], ma);
  }
  int ans = 1;
  for (long long i = 0; i < n; i++) {
    if (a[i] == ma) {
      int j = i;
      int c = 0;
      while (j < n && a[j] == ma) {
        j++;
        c++;
      }
      ans = max(ans, c);
      i = j - 1;
    }
  }
  cout << ans;
}
