import Control.Applicative
import Debug.Trace

binarySearch :: Ord a => a -> [a] -> Bool
binarySearch a xs = search (div (length xs) 2) xs
  where
    search _ [x] = if x == a then True else False
    search n xs
      | b == a = True
      | b < a  = search (div n 2) (b : bs)
      | otherwise = search (div n 2) as
      where (as, b : bs) = splitAt (n + 1) xs

main :: IO ()
main = do
  _  <- getLine
  xs <- words <$> getLine
  _  <- getLine
  ys <- words <$> getLine
  putStrLn $ show $ length [y | y <- ys, binarySearch y xs]

