#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 * 100;
int n;
pair<int, int> sora[maxn + 100];
int lpos = 0;
bool seen[maxn + 100];
bool comp(pair<int, int> a, pair<int, int> b) {
  if (a.first < b.first)
    return true;
  else {
    if (a.first == b.first)
      return a.second < b.second;
    else
      return false;
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int temp;
    scanf("%d", &temp);
    sora[i] = make_pair(temp, i);
  }
  sort(sora, sora + n, comp);
  int co = 0;
  for (int i = 0; i < n; i++) {
    seen[sora[i].second] = true;
    while (lpos < n && seen[lpos]) lpos++;
    if (lpos > i || lpos == n) {
      co++;
    }
  }
  cout << co << endl;
}
