program main
    implicit none
    integer, allocatable:: p(:)
    integer:: n, now_min, i, count

    read*, n
    allocate(p(n))
    read*, p(:)

    now_min = n+1
    count = 0
    do i = 1, n
        if (p(i) < now_min)then
            now_min = p(i)
            count = count + 1
        end if
    end do

    print*, count
    
end program main