let split_string ?(pattern="") = Str.split @@ Str.regexp pattern
let n = Scanf.sscanf (read_line ()) "%d" @@ fun n -> n
let s = read_line () |> split_string |> Array.of_list

let () =
  let black = Array.init n (fun i -> if s.(i) = "#" then 1 else 0) in
  let white = Array.init n (fun i -> if s.(i) = "." then 1 else 0) in
  for i = 1 to n - 1 do black.(i) <- black.(i) + black.(i - 1) done;
  for i = n - 2 downto 0 do white.(i) <- white.(i) + white.(i + 1) done;
  List.map2 (+) (Array.to_list black) (Array.to_list white)
    |> List.fold_left min max_int
    |> (fun i -> Printf.printf "%d\n" @@ i - 1)