import System.IO doStep (0, valleys) 'D' = (-1, valleys+1) doStep (level, valleys) 'D' = (level-1, valleys) doStep (level, valleys) 'U' = (level+1, valleys) countValleys :: [Char] -> Integer countValleys steps = snd $ foldl doStep (0, 0) steps main = do l0 <- getLine l1 <- getLine let n = read l0 steps = take n l1 putStrLn $ show $ countValleys steps