#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cout << x; }
void __print(long x) { cout << x; }
void __print(long long x) { cout << x; }
void __print(unsigned x) { cout << x; }
void __print(unsigned long x) { cout << x; }
void __print(unsigned long long x) { cout << x; }
void __print(float x) { cout << x; }
void __print(double x) { cout << x; }
void __print(long double x) { cout << x; }
void __print(char x) { cout << '\'' << x << '\''; }
void __print(const char *x) { cout << '\"' << x << '\"'; }
void __print(const string &x) { cout << '\"' << x << '\"'; }
void __print(bool x) { cout << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  __print(x.first);
  cout << ',';
  __print(x.second);
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  for (auto &i : x) cout << (f++ ? "," : ""), __print(i);
}
void _print() { cout << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cout << ", ";
  _print(v...);
}
const int N = 55, M = 2505;
const int MOD = 1e9 + 7;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> v(n);
  map<int, vector<int> > m;
  for (int i = 0; i < n; i++) cin >> v[i], m[v[i]].push_back(i);
  int mx = *max_element(v.begin(), v.end());
  if (m[mx].size() == 1) {
    cout << 1;
    return 0;
  }
  int res = 0, cur = 1;
  for (int i = 1; i < m[mx].size(); i++) {
    if (m[mx][i] != m[mx][i - 1] + 1)
      res = max(res, cur), cur = 1;
    else
      cur++;
  }
  cout << max(res, cur);
  return 0;
}
