main = do
  nIn <- getLine
  s <- getLine
  let
    n = head $ map read $ words nIn :: Int
    fun s prev ans
      | s == [] = ans
      | prev == '#' && head s == '#' = fun (tail s) '#' ans
      | prev == '#' && head s == '.' = fun (tail s) '#' (ans+1)
      | prev == '.' && head s == '#' = fun (tail s) '#' ans
      | prev == '.' && head s == '.' = fun (tail s) '.' ans
      | otherwise = -1
    in
    putStrLn $ show $ fun s '.' 0

