program main
  implicit none
  integer :: i, n, lw=0, white=0, black=0
  logical :: flag = .false.
  character(200000) :: s

  read *, n
  read *, s

  lw = verify(trim(s), '#', back=.true.)

  do i = 1, n
    if (s(i:i) == '#') flag = .true.
    if ((flag) .and. (s(i:i) == '#')) black = black + 1
    if ((flag) .and. (s(i:i) == '.')) white = white + 1
  end do

  print '(i0)', min(black, white)-n+lw

end program
