import Control.Applicative
import Control.Monad
import Data.Array.IArray

main = do
  n <- readLn
  slist <- map read.words<$>getLine
  q <- getLine
  ts <- map read.words<$>getLine
  let ss = listArray (1,n) slist :: Array Int Int
  print.length.filter (binSearch ss) $ ts

binSearch arr x = bins' st en arr x
  where (st,en) = bounds arr

bins' l r arr x 
  | abs (l-r) <= 1          = x `elem` [arr!l,arr!r]
  | arr!m `compare` x == LT = bins' m r arr x
  | arr!m `compare` x == GT = bins' l m arr x
  | arr!m `compare` x == EQ = True
  where m = (l+r) `div` 2