#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long inf = 1e18;
const int maxn = 1e5 + 10;
const double eps = 1e-7;
const double pi = 3.14159265359;
int a[maxn];
int ans;
int mx;
int main() {
  std::ios::sync_with_stdio(0);
  ;
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    mx = max(mx, a[i]);
  }
  int now = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == mx) {
      now++;
    }
    if (a[i] != mx) {
      ans = max(ans, now);
      now = 0;
    }
  }
  ans = max(ans, now);
  cout << ans;
}
