#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  vector<long long int> v(n);
  vector<long long int> a;
  unordered_map<long long int, long long int> pos;
  unordered_map<long long int, long long int> counter;
  for (long long int i = 0; i < n; i++) {
    cin >> v[i];
  }
  a = v;
  sort(a.begin(), a.end());
  for (long long int i = 0; i < n; i++) {
    if (counter[a[i]] > 0) {
      counter[a[i]]++;
    } else {
      counter[a[i]]++;
      pos[a[i]] = i;
    }
  }
  long long int res = 0;
  long long int index = -1;
  for (long long int i = 0; i < n; i++) {
    index = max(index, pos[v[i]]);
    if (counter[v[i]] > 1) {
      counter[v[i]]--;
      pos[v[i]]++;
    }
    if (index == i) {
      res++;
      index = -1;
    }
  }
  cout << res << "\n";
}
