import Control.Applicative

binSearch :: [Int] -> Int -> Bool
binSearch [] _ = False
binSearch xs k =
  let p = length xs `div` 2
      c = xs !! p
  in
      ((k == c) ||
          (if k < c then binSearch (take p xs) k
            else binSearch (drop (p+1) xs) k))

solver :: [Int] -> [Int] -> Int
solver ss qs =
  let bAns = map (binSearch ss) qs
  in
      length $ filter (== True) bAns

main :: IO()
main = do
  _ <- getLine
  ss <- map (read :: String -> Int) . words <$> getLine
  _ <- getLine
  qs <- map (read :: String -> Int) . words <$> getLine
  print $ solver ss qs