#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int cur = 0;
  for (int i = 0; i < n; i++) {
    cur = max(cur, a[i]);
  }
  int tl = 0;
  int tr = -1;
  for (int i = 0; i < n; i) {
    if (a[i] == cur) {
      int l = i;
      int r = l;
      i++;
      while (i < n and a[i] == cur) {
        r++;
        i++;
      }
      if (r - l + 1 > tr - tl + 1) {
        tr = r;
        tl = l;
      }
    } else {
      i++;
    }
  }
  cout << tr - tl + 1 << endl;
  return 0;
}
