#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;
int IT_MAX = 1 << 19;
const long long MOD = 998244353;
const int INF = 0x3f3f3f3f;
const long long LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);
const double ERR = 1e-10;
int main() {
  long long n, a[100009], ans = 0, mx = -1, cnt = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    mx = max(a[i], mx);
  }
  for (int i = 0; i < n; i++) {
    if (a[i] == mx) {
      cnt++;
    } else {
      if (ans < cnt) {
        ans = cnt;
      }
      cnt = 0;
    }
  }
  if (ans < cnt) {
    ans = cnt;
  }
  cout << ans << endl;
  return 0;
}
