#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(NULL);
  int vmax = 0;
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i], vmax = max(vmax, a[i]);
  int result = 0, total = 0;
  for (int i = 0; i < n; ++i)
    if (a[i] != vmax)
      total = 0;
    else {
      total++;
      result = max(result, total);
    }
  cout << result;
  return 0;
}
