binarySearch :: Int -> [Int] -> Bool
binarySearch _ []  = False
binarySearch n [b] = n == b
binarySearch n xs
  | n == b    = True
  | n < b     = binarySearch n as
  | otherwise = binarySearch n bs
  where (as, b:bs) = splitAt (floor ((fromIntegral . length $ xs) / 2)) xs

main = do
  _ <- getLine
  seqNum <- fmap (map read . words) getLine
  _ <- getLine
  targets <- fmap (map read . words) getLine
  putStrLn $ show . length . filter (\x -> binarySearch x seqNum) $ targets