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

main :: IO ()
main = do
  _ <- getLine
  s <- map read . words <$> getLine
  _ <- getLine
  t <- map read . words <$> getLine
  print $ solve s t

solve :: [Int] -> [Int] -> Int
solve s t = length $ filter (`Map.member` s') t
  where
    s' = (Map.fromList [(k, k) | k <- s])

