#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
const double eps = 0.01;
void solution() {
  int n;
  cin >> n;
  vector<int> h(n + 1);
  map<pair<int, int>, int> data;
  map<pair<int, int>, int>::iterator iter;
  for (int i = 1; i <= n; i++) {
    cin >> h[i];
    data[make_pair(h[i], i)]++;
  }
  vector<pair<int, int> > coll;
  int place = 0;
  for (iter = data.begin(); iter != data.end(); iter++) {
    for (int j = 0; j < iter->second; j++) {
      place++;
      coll.push_back(make_pair(place, iter->first.second));
    }
  }
  for (int i = 0; i < n; i++) {
    if (coll[i].first > coll[i].second) {
      swap(coll[i].first, coll[i].second);
    }
  }
  sort(coll.begin(), coll.end());
  int L = coll[0].first;
  int R = coll[0].second;
  int answer = 0;
  for (int i = 1; i < n; i++) {
    int l2 = coll[i].first;
    int r2 = coll[i].second;
    if (l2 <= R) {
      R = max(R, r2);
    } else {
      L = l2;
      R = r2;
      answer++;
    }
  }
  cout << answer + 1 << "\n";
}
void include_file() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
int main() {
  solution();
  return 0;
}
