f s m | null s = null m | null m = f ts [x] | [x, y] == ")(" = f ts tm | otherwise = f ts (x : m) where (x : ts) = s (y : tm) = m main :: IO () main = do n <- read <$> getLine :: IO Int s <- getLine let x = length $ filter (=='(') s y = length $ filter (==')') s bl = f s [] putStrLn $ if bl then "Yes" else "No"