main = do
  _ <- getLine
  s <- fmap (map read . words) getLine
  _ <- getLine
  t <- fmap (map read . words) getLine
  print $ search s t

search :: [Int] -> [Int] -> Int
search s t = length $ filter (\x -> x `elem` s) t