#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, max = 0, count = 0, max_count = 0, i;
  cin >> n;
  vector<long long> v(n);
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n))) {
    cin >> v[i];
    if (v[i] > max) max = v[i];
  }
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n))) {
    if (v[i] == max)
      count++;
    else
      count = 0;
    if (count > max_count) max_count = count;
  }
  cout << max_count;
}
