#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, cnt = 1, flag = 0, g = 6547765, j = 0;
  cin >> n;
  int a[100005];
  int b[100005];
  int c[100005];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    b[i] = a[i];
  }
  sort(a, a + n);
  int l = a[n - 1];
  if (n == 1) {
    cout << cnt;
    return 0;
  }
  for (int i = 0; i < n; i++) {
    if (b[i] == l) {
      if ((g + 1) == i) {
        cnt++;
        g = i;
      }
      g = i;
      if (i == (n - 1)) {
        c[j] = cnt;
        j++;
      }
    } else {
      c[j] = cnt;
      j++;
      cnt = 1;
    }
  }
  sort(c, c + j);
  cout << c[j - 1];
}
