#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double EPS = 1e-11;
const long long MOD = 1000000007;
const int N = 1005;
void fast() { std::ios_base::sync_with_stdio(0); }
int main() {
  int n, mx = -1, ind;
  vector<int> v;
  scanf("%d", &n);
  vector<int> arr(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
    if (arr[i] > mx) {
      mx = arr[i];
      ind = i;
    }
  }
  for (int i = 0; i < n; i++)
    if (arr[i] == mx) v.push_back(i);
  int cnt = 1;
  int ans = 1;
  for (int i = 1; i < v.size(); i++) {
    if (v[i] == v[i - 1] + 1) {
      cnt++;
      ans = max(cnt, ans);
    } else
      cnt = 1;
  }
  printf("%d\n", ans);
  return 0;
}
