import Control.Applicative
main = do
        n <- getLine
        xs <- map read.words<$>getLine :: IO ([Int])
        n <- getLine
        ys <- map read.words<$>getLine
        print $ countElems ys xs

linearSearch x [] = Nothing
linearSearch x (y:ys)
    | x == y = Just x
    | x /= y = linearSearch x ys

countElems xs ys = foldr (\x acc -> if p (f x) then 1+acc else acc) 0 xs
                                               where p = (/= Nothing)
                                                     f x = linearSearch x ys
--length.filter (/= Nothing) $ map (\x -> linearSearch x ys) xs