#include <bits/stdc++.h>
using namespace std;
int main() {
  int long long n, i, j, k, l, sum, a, sum1;
  cin >> n;
  int long long num[n];
  a = 0;
  for (i = 0; i < n; i++) {
    cin >> num[i];
    if (a < num[i]) {
      a = num[i];
    }
  }
  sum = 0;
  for (i = 0; i < n;) {
    if (num[i] == a) {
      sum1 = 0;
      while (num[i] == a) {
        sum1++;
        i++;
        if (i == n) {
          break;
        }
      }
      if (sum < sum1) {
        sum = sum1;
      }
    } else {
      i++;
    }
  }
  cout << sum << endl;
}
