import Data.Vector (Vector, (!), fromList)
import Data.Functor ((<$>))

binarySearch :: Ord a => Vector a -> Int -> Int -> a -> Bool
binarySearch a left right x
  | left == right = False
  | x < y = binarySearch a left mid x
  | x > y = binarySearch a (mid + 1) right x
  | otherwise = True
  where mid = left + (right - left) `div` 2
        y = a ! mid

main = do
    n <- readLn :: IO Int
    s <- fromList . map read . words <$> getLine :: IO (Vector Int)
    q <- readLn :: IO Int
    t <- map read . words <$> getLine :: IO [Int]
    print $ (length . filter (binarySearch s 0 n)) t
