#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  vector<long long> mas;
  for (long long i = 0; i < n; i++) {
    long long a;
    cin >> a;
    mas.push_back(a);
  }
  vector<long long> s_array;
  s_array = mas;
  sort(s_array.begin(), s_array.end());
  long long i = 0;
  long long count = 0;
  long long max, j, max_count1, max_count2, min;
  while (i < n) {
    max = mas[i];
    min = mas[i];
    max_count1 = 1;
    max_count2 = 1;
    j = i;
    while (min != s_array[i] || max != s_array[j] || max_count1 != max_count2) {
      j++;
      if (mas[j] < min) min = mas[j];
      if (mas[j] == max) {
        max_count2++;
      }
      if (mas[j] > max) {
        max = mas[j];
        max_count2 = 1;
      }
      if (s_array[j] == s_array[j - 1]) max_count1++;
      if (s_array[j] > s_array[j - 1]) {
        max_count1 = 1;
      }
    }
    count++;
    i = j + 1;
  }
  cout << count;
  getchar();
  getchar();
  return 0;
}
