#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n + 5], mx = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] > mx) {
      mx = a[i];
    }
  }
  int cnt = 0, ans = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == mx) {
      cnt++;
    } else {
      if (cnt > ans) {
        ans = cnt;
      }
      cnt = 0;
    }
  }
  if (cnt > ans) {
    ans = cnt;
  }
  cout << ans << endl;
  return 0;
}
