import Data.List import Control.Monad import Data.Char main :: IO () main = readLn >>= main' where main' n = getLine >>= print . solve n solve :: Int -> String -> Int solve n xs | 6 > n + c = 6 - n | otherwise = c where c = length $ filter (== 0) [d, l, u, s] (d, l, u, s) = foldl' ff (0, 0, 0, 0) xs ff (w, x, y, z) v | isDigit v = (w + 1, x, y, z) | isAsciiLower v = (w, x + 1, y, z) | isAsciiUpper v = (w, x, y + 1, z) | otherwise = (w, x, y, z + 1)