#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const double eps = .0000000001;
inline void prep() {
  cin.tie(0);
  cin.sync_with_stdio(0);
};
double pi = 3.1415926535897;
int main() {
  int n;
  cin >> n;
  int arr[n];
  int maxx = -1;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    if (arr[i] > maxx) {
      maxx = arr[i];
    }
  }
  int maxcnt = 1;
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (arr[i] == maxx) {
      cnt++;
      if (cnt > maxcnt) {
        maxcnt = cnt;
      }
    } else {
      cnt = 0;
    }
  }
  cout << maxcnt;
  return 0;
}
