/*
* Name : Md. Fahmidur Rahman Nafi
* Date : 2025-04-06 Time : 21:26:11
*/
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define ld long double
#define ull unsigned long long
#define lcm(a,b) ((a*b)/__gcd(a,b))
#define debug(x) cout << "Debug : " << x << endl;
const double PI = 2 * acos(0.0);
const int MOD = 1000000007;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector <ll> a(n);
map <int,vector <int>> mp;
for (int i = 0; i < n; i++){
cin >> a[i];
mp[a[i]].push_back(i);
}
int cnt = 0;
for (int i = 0; i < n; i++){
int big = 0, small = 0;
for (auto &j : mp){
auto lst = j.second;
if (j.first >= a[i]){
for (auto &x : lst){
if (x > i)
big++;
}
}
if (j.first <= a[i]){
for (auto &x : lst){
if (x < i)
small++;
}
}
}
if (small >= a[i] || big >= a[i]){
cnt++;
}
}
cout << cnt << endl;
}