#include <bits/stdc++.h>
using namespace std;
int num[1001000];
int main() {
  int n;
  cin >> n;
  int maxx = -0x3f3f3f3f, ans = 0;
  for (int i = 1; i <= n; i++) {
    cin >> num[i];
    maxx = max(num[i], maxx);
  }
  int k = 1;
  for (int i = 1; i <= n; i++) {
    if (num[i] == maxx && num[i + 1] == maxx && i + 1 <= n)
      k++;
    else {
      ans = max(ans, k);
      k = 1;
    }
  }
  cout << ans << endl;
  return 0;
}
