#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, mx = 0, l = 0, ans = 0;
  cin >> n;
  long long a[n + 1];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    mx = max(mx, a[i]);
  }
  for (int i = 0; i < n; i++) {
    l = 0;
    if (a[i] == mx) {
      l++;
      int x = i + 1;
      while (x < n && a[x] == mx) {
        l++;
        x++;
      }
      i = x;
      ans = max(ans, l);
    }
  }
  cout << ans << endl;
  return 0;
}
