#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, k = 0, p, j, ans = 0;
  scanf("%d", &n);
  pair<int, int> arr[100001];
  arr[0].first = 0;
  arr[0].second = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    if (x >= arr[k].second) {
      k++;
      ans++;
      arr[k].first = x;
      arr[k].second = x;
      continue;
    }
    arr[k].first = min(arr[k].first, x);
    arr[k].second = max(arr[k].second, x);
    for (j = k; j >= 0; j--) {
      if (x >= arr[j].second) {
        p = j + 1;
        arr[p].first = min(arr[p].first, x);
        arr[p].second = arr[k].second;
        k = p;
        break;
      }
    }
  }
  cout << k;
  return 0;
}
