let () = Scanf.scanf "%d\n" @@ fun n ->
  let ps = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun p -> p in
  let acc = Array.make (n + 1) max_int in
  for i = 0 to n - 1 do
    acc.(i + 1) <- min ps.(i) acc.(i)
  done;
  Printf.printf "%d\n" @@
  Array.fold_left ( + ) 0 @@
  Array.init n @@ fun i ->
    if ps.(i) <= acc.(i) then 1 else 0
