import Control.Applicative
-- import Control.Monad

binarySearch :: [Int] -> Int -> Bool
binarySearch [] _ = False
binarySearch [x] v = x == v
binarySearch xs v
  | v == b = True
  | v > b  = binarySearch bs v
  | v < b  = binarySearch as v
  where (as, b : bs) = splitAt (div (length xs) 2) xs

main :: IO ()
main = do
  _ <- getLine
  s <- map read . words <$> getLine
  _ <- getLine
  t <- map read . words <$> getLine
  let ans = length $ filter (binarySearch s) t
  print ans

