#include <bits/stdc++.h>
using namespace std;
int pair[10005];
int main() {
  int n;
  long long int A, B = 0;
  int count, result, min, max = 0;
  std::cin >> count;
  long long int value[count];
  for (int i = 0; i < count; i++) {
    std::cin >> value[i];
    if (value[i] > max) max = value[i];
  }
  min = max;
  for (int i = count - 1; i >= 0; i--) {
    if (value[i] <= min) {
      min = value[i];
      result += 1;
    }
  }
  std::cout << result << std::endl;
  return 0;
}
