import Data.List
import qualified Data.ByteString.Char8 as BC
import Data.Maybe (fromJust)
import Control.Monad
import Data.Functor
import qualified Data.IntSet as IntSet

readInts :: IO [Int]
readInts = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

main :: IO()
main = do
  _ <- fmap read getLine :: IO Int
  ss <- readInts
  _ <- fmap read getLine :: IO Int
  ts <- readInts
  print $ solve' ss ts

solve' :: [Int] -> [Int] -> Int
solve' ss ts = foldl' (\acc t -> acc + if IntSet.member t sSet then 1 else 0) 0 $ ts 
  where
    sSet = IntSet.fromList ss

