let () =
  Scanf.scanf "%d %s" @@ fun n s ->
  let a = Array.init (n+1) (fun i -> if i > 0 && s.[i-1] = '#' then 1 else 0) in
  for i = 1 to n do a.(i) <- a.(i) + a.(i-1) done;
  Array.init (n+1) (fun i -> a.(i) + (n - i) - (a.(n) - a.(i)))
  |> Array.fold_left min n |> Printf.printf "%d\n"

