#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;
constexpr long long INF = numeric_limits<LL>::max();
const double PI = acos(-1);
struct Tll {
  LL first, second, third;
};
struct Fll {
  LL first, second, third, fourth;
};
void YN(bool f) {
  if (f)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
void yn(bool f) {
  if (f)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
struct Edge {
  LL to, cost;
};
struct edge {
  LL from, to, cost;
};
vector<vector<LL>> g, rvec;
vector<edge> ed;
vector<LL> v;
vector<pair<LL, LL>> pv;
map<string, LL> ma;
set<LL> st;
int di[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
string str, ss;
LL n, m, h, w, p, q, s, t, ans, cnt, last;
pair<LL, LL> a[220000], b[220000];
char c[3000][3000];
int main() {
  cin >> n;
  for (LL i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a, a + n, [](pair<LL, LL> x, pair<LL, LL> y) {
    return x.first == y.first ? x.second < y.second : x.first > y.first;
  });
  LL num = a[0].first, bef = -1;
  for (LL i = 0; i < n; i++) {
    if (a[i].first == num) {
      if (bef + 1 == a[i].second) {
        bef = a[i].second;
        cnt++;
      } else {
        ans = max(ans, cnt);
        bef = a[i].second;
        cnt = 0;
        cnt++;
      }
    } else
      break;
  }
  cout << max(ans, cnt) << endl;
  return 0;
}
