/* -*- coding: utf-8 -*- * * 1438.cc: No.1438 Broken Drawers - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_N = 200000; /* typedef */ typedef pair pii; /* global variables */ pii ais[MAX_N]; bool used[MAX_N]; /* subroutines */ /* main */ int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", &ais[i].first), ais[i].second = i - 1; sort(ais, ais + n); int m = 0; for (int i = 0; i < n; i++) { int aj = ais[i].first, j = ais[i].second; if (j + 1 >= n || ! used[j + 1]) m++, used[j] = true; } printf("%d\n", m); return 0; }