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