#include <bits/stdc++.h>
using namespace std;
vector<int> v;
set<int> st;
map<int, int> Mp;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    v.push_back(a);
  }
  int cnt1 = 1, cnt2 = 1;
  for (int i = 0; i < n; i++) {
    st.insert(v[i]);
    Mp[v[i]]++;
  }
  int mx = 0;
  int x = v[v.size() - 1];
  for (auto i : st) {
    if (i < x) {
      mx = max(mx, Mp[i]);
    }
  }
  cout << Mp[x] + mx << endl;
  return 0;
}
