#include <bits/stdc++.h>
using namespace std;
vector<vector<long long>> g;
vector<char> visited;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int m = *max_element(a.begin(), a.end());
  int ans = 1;
  int temp = 1;
  for (int i = 1; i < n; i++) {
    if (a[i] == m && a[i - 1] == m) {
      temp++;
    } else {
      temp = 1;
    }
    ans = max(ans, temp);
  }
  cout << ans;
}
