#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int T = 1;
  while (T--) {
    int n;
    cin >> n;
    vector<int> v(n);
    int maxi = 0;
    for (int i = 0; i < n; i++) {
      cin >> v[i];
      maxi = max(maxi, v[i]);
    }
    int i = 0;
    int ans = 0;
    while (i < n) {
      int t = 0;
      while (i < n && v[i] == maxi) {
        t++;
        i++;
      }
      ans = max(ans, t);
      i++;
    }
    cout << ans;
  }
  return 0;
}
