program tenka1_2019_c
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n,i,cw,ans
    character(:),allocatable:: s

    read*, n
    allocate(character(n):: s)
    read*, s(:)
    cw = 0
    ans = 0
    do i=n,1,-1
        if (s(i:i) == '#') then
            ans = cw
        else
            cw=cw+1
        end if
    end do

    print'(i0)', ans
end program tenka1_2019_c