import qualified Data.Map.Strict as Map
import Control.Applicative

main :: IO ()
main = do
  _ <- getLine
  s <- Map.fromList . map (\k -> (read k, 1)) . words <$> getLine
  _ <- getLine
  t <- map read . words <$> getLine
  let ans = solve s t
  print ans

solve :: Map.Map Int Int -> [Int] -> Int
solve s t = length $ filter (`Map.member` s) t

