#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
int specialCount = 0;
for (int i = 0; i < n; i++) {
int greaterOrEqualRight = 0;
int smallerOrEqualLeft = 0;
// Count greater or equal elements on the right
for (int j = i + 1; j < n; j++) {
if (a[j] >= a[i])
greaterOrEqualRight++;
}
// Count smaller or equal elements on the left
for (int j = 0; j < i; j++) {
if (a[j] <= a[i])
smallerOrEqualLeft++;
}
// Check if any of the two conditions are satisfied
if (greaterOrEqualRight >= a[i] || smallerOrEqualLeft >= a[i])
specialCount++;
}
cout << specialCount << endl;
return 0;
}