#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) { cerr << endl; }
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << " , ";
  err(++it, args...);
}
namespace fastIO {
bool IOerror = 0;
inline char nc() {
  static char buf[100000], *p1 = buf + 100000, *pend = buf + 100000;
  if (p1 == pend) {
    p1 = buf;
    pend = buf + fread(buf, 1, 100000, stdin);
    if (pend == p1) {
      IOerror = 1;
      return -1;
    }
  }
  return *p1++;
}
inline bool blank(char ch) {
  return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t';
}
inline void read(int &x) {
  char ch;
  while (blank(ch = nc()))
    ;
  if (IOerror) return;
  for (x = ch - '0'; (ch = nc()) >= '0' && ch <= '9'; x = x * 10 + ch - '0')
    ;
}
}  // namespace fastIO
using namespace fastIO;
const double PI = acos(-1.0);
const double eps = 1e-8;
const int maxn = 3e5 + 7;
const int N = 5e5 + 10;
int a[N];
int main() {
  int n;
  cin >> n;
  int mx = 0;
  for (int i = 1; i <= n; ++i) cin >> a[i], mx = max(mx, a[i]);
  int ans = 1;
  int len = 0;
  for (int i = 1; i <= n; ++i) {
    if (a[i] == mx)
      len++;
    else
      len = 0;
    ans = max(ans, len);
  }
  cout << ans << endl;
}
