#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  long long arr[n], cap = -1LL << 30;
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
    if (cap < arr[i]) cap = arr[i];
  }
  long long c = 0;
  std::vector<long long> v;
  for (long long i = 0; i < n; i++) {
    if (arr[i] == cap) {
      c++;
      v.push_back(i);
    }
  }
  if (cap == 0 || c == n) {
    cout << n << endl;
    return 0;
  }
  long long cnt = 0, ans = -1LL << 30;
  for (long long i = 0; i < n; i++) {
    if (arr[i] == cap) {
      cnt = 0;
      while (arr[i] == cap) {
        cnt++;
        i++;
      }
      ans = max(ans, cnt);
    }
  }
  cout << ans << endl;
  return 0;
}
