#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int a[N], n;
int main() {
  cin >> n;
  int mx = -1;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    mx = max(mx, a[i]);
  }
  int ans = 0, len = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] == mx) {
      while (i <= n && a[i] == mx) {
        len++;
        i++;
      }
      ans = max(ans, len);
      len = 0;
    }
  }
  cout << ans << endl;
}
