#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("avx,avx2,fma")
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long a;
  cin >> a;
  long long c = 0;
  for (int i = (0), ThxMK = (n - 1); i < ThxMK; ++i) {
    long long b;
    cin >> b;
    if (a > b) {
      c++;
    } else {
      a = b;
    }
  }
  cout << c << '\n';
  return 0;
}
