function *main() {
  
  const N = +(yield);
  const P = (yield).split(" ").map(s => +s);
  let m = 20001, ans = 0;
  for (let p of P) {
    if (p < m) ans++;
    m = Math.min(m, p);
  }
  console.log(ans);
  
}
const iter = main();
iter.next();
require("readline").createInterface({input: process.stdin, output: process.stdout}).on("line", line => iter.next(line));