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