import Control.Applicative

search :: Eq a => [a] -> [a] -> Int
search xs ys = length [y | y <- ys, elem y xs]

main :: IO ()
main = do
  _  <- getLine
  xs <- words <$> getLine
  _  <- getLine
  ys <- words <$> getLine
  putStrLn $ show $ search xs ys

