let _ =
  let n = Scanf.scanf "%d\n" (fun n -> n) in
  let ar = Array.make n '#' in
  for i = 0 to n - 1 do
    Scanf.scanf (if i <> n-1 then "%c" else "%c\n") (fun c -> ar.(i) <- c)
  done;
  let rec in_dot cnt i =
    if i = n then cnt
    else if ar.(i) = '#' then in_sharp cnt 0 i
    else in_dot cnt (i + 1)
  and in_sharp cnt ss i =
    if i = n then cnt
    else
      if ar.(i) = '.' then 
        fill_dot cnt ss 0 i
      else
        in_sharp cnt (ss + 1) (i + 1)
  and fill_dot cnt ss ds i =
    if i = n then cnt + (min ss ds)
    else if ar.(i) = '#' then in_sharp (cnt + (min ss ds)) 0 i
    else fill_dot cnt ss (ds+1) (i+1)
  in
  print_int @@ in_dot 0 0
