#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int pos[maxn];
int a[maxn];
int main() {
  int n;
  int maxn = -1;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    maxn = max(a[i], maxn);
  }
  int ans = 1;
  for (int i = 1; i <= n; i++) {
    if (a[i] == maxn) {
      int cur = 1;
      while (a[i + 1] == maxn && i + 1 <= n) {
        i++;
        cur++;
      }
      ans = max(cur, ans);
    }
  }
  cout << ans << endl;
  return 0;
}
