import Control.Monad
import Control.Applicative
import Data.Functor
import Data.List
import Data.List.Split
import Data.Char

readInt = read :: String -> Int
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
-- end of templete

slices _ [] = []
slices n s = (take n s:slices n (drop n s))

hit as bs = length $ filter (uncurry (==)) $ zip as bs
blow as bs = subtract (hit as bs) $ length $ intersect as bs

hitAndBlow [as,bs] = unwords . map show $ [hit as bs, blow as bs] 

main = slices 2 . map (map readInt . words) . lines <$> getContents >>= mapM_ (putStrLn . hitAndBlow)