#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<pair<int, int> > a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i + 1;
  }
  sort(a.begin(), a.end());
  vector<int> A(n);
  for (int i = 0; i < n; i++) A[a[i].second - 1] = i + 1;
  int valueNeeded = 1, maxVal = 0;
  int maxBlocks = 0, curBlock = 0;
  bool hasSeen = false;
  for (int i = 0; i < n; i++) {
    maxVal = max(maxVal, A[i]);
    curBlock++;
    if (A[i] == valueNeeded) {
      hasSeen = true;
    }
    if (hasSeen && maxVal - valueNeeded + 1 == curBlock) {
      maxBlocks++;
      curBlock = 0;
      valueNeeded = maxVal + 1;
      hasSeen = false;
    }
  }
  cout << maxBlocks << "\n";
}
