#include <bits/stdc++.h>
using namespace std;
int s[100100];
int a[100100];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &s[i]);
    a[i] = s[i];
  }
  sort(s, s + n);
  int blocks = 0, index;
  bool bl;
  for (int i = 0; i < n;) {
    index = lower_bound(s, s + n, a[i]) - s;
    bl = true;
    int j = i + 1;
    for (; j <= index; j++) {
      if (a[j] > a[i]) {
        i = j;
        bl = false;
        break;
      } else if (a[j] == a[i]) {
        if (index < n) index++;
      }
    }
    if (bl) {
      i = j;
      blocks++;
    }
  }
  printf("%d\n", blocks);
}
