program main
  implicit none
  integer i, H, W, ans, score, plus, j
  integer,allocatable :: SS(:,:)
  integer,allocatable :: Move(:)
  character(100) S
  read(*, *)H, W
  allocate(SS(H,W))
  allocate(Move(W+1))
  !read(*, *) (L(i), i = 1,N)
  do i = 1,H
    read(*, *) S
    do j = 1, W
      if (S(j:j) == '#') then
        SS(j,i) = 1
      else
        SS(j,i) = 0
      endif
    enddo
  enddo
  
  Move = 1
  Move(W+1) = H
  ans = 300
  
  do
    score = 0
    do i = 1,W
      do j = Move(i),Move(i+1)
        score = score + SS(i,j)
      enddo
    enddo
    
    if (score < ans) then
      ans = score
    endif
    
    if (Move(W) == H) then
      plus = W
      do
        if (Move(plus) == H) then
          Move(plus) = 1
          plus = plus - 1
        else
          Move(plus) = Move(plus) + 1
          do i = plus+1,W
            Move(i) = Move(plus)
          end do
          exit
        endif
      enddo
    else
      Move(W) = Move(W) + 1
    endif
    
    if (Move(1) == 2) then
      exit
    endif
    
  enddo
  write(*, *) ans
end program main
