#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int h[100000];
  vector<pair<int, int> > pairs;
  stack<pair<int, int> > minmax;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> h[i];
    pairs.push_back(pair<int, int>(h[i], i));
  }
  sort(pairs.begin(), pairs.end());
  for (int i = 0; i < n; ++i) {
    int first = min(i, pairs[i].second);
    int last = max(i, pairs[i].second);
    while (not minmax.empty()) {
      int prev_first = minmax.top().first;
      int prev_last = minmax.top().second;
      if (not(last < prev_first or prev_last < first)) {
        first = min(first, prev_first);
        last = max(last, prev_last);
        minmax.pop();
      } else {
        break;
      }
    }
    minmax.push(pair<int, int>(first, last));
  }
  cout << minmax.size() << endl;
  return 0;
}
