import Control.Applicative

lSearch :: [Int] -> Int -> Bool
lSearch [] _ = False
lSearch (x:xs) q
  | x == q = True
  |otherwise = lSearch xs q

solver :: [Int] -> [Int] -> Int
solver ss qs =
  let bAns = map (lSearch 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