import           Control.Applicative
import           Control.Monad

main :: IO ()
main = do
    getLine
    ss <- fmap read . words <$> getLine :: IO [Int]
    getLine
    ts <- fmap read . words <$> getLine :: IO [Int]
    print . length $ filter (`elem` ss) ts

