#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int OO = 0x3f3f3f3f;
int A[N];
int B[N];
int x, n, a, n2, k, b, xx, t, m, l, c, fn, ch, total, y;
string s, s2, s3;
int row, col, rs, cs;
int cost;
int main() {
  int cnt = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> A[i];
    B[i] = A[i];
  }
  sort(B, B + n);
  x = 0;
  for (int i = 0; i < n && x < n; i++) {
    if (A[i] > B[x] || !x)
      x = lower_bound(B + x + (!x ? i : 0), B + n, A[i]) - B;
    else if (A[i] == B[x] && x)
      x++;
    if (i == x) x = 0, c++;
  }
  cout << c;
  return 0;
}
