#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, temp;
  cin >> n;
  vector<int> arr1(n + 1), arr2(n + 1);
  map<int, int> mymap;
  for (int i = 0; i < n; i++) {
    cin >> arr1[i];
    arr2[i] = arr1[i];
  }
  sort(arr2.begin(), arr2.end());
  pair<int, int> parr[n + 1];
  vector<int>::iterator up, low;
  for (int i = 0; i < n; i++) {
    low = lower_bound(arr2.begin(), arr2.end(), arr1[i]);
    temp = (low - arr2.begin()) + mymap[arr1[i]] - 1;
    mymap[arr1[i]]++;
    if (temp < i)
      parr[i] = pair<int, int>(temp, i);
    else
      parr[i] = pair<int, int>(i, temp);
  }
  int ans = 1;
  int l = parr[0].first;
  int r = parr[0].second;
  for (int i = 1; i < n; i++) {
    if (parr[i].first > r) {
      ans++;
      l = parr[i].first;
      r = parr[i].second;
    } else if (parr[i].second <= r)
      continue;
    else {
      r = parr[i].second;
    }
  }
  cout << ans << endl;
  return 0;
}
