import Data.List

main :: IO()
main = do
  _ <- fmap read getLine :: IO Int
  ss <- fmap (map read . words) getLine :: IO [Int]
  _ <- fmap read getLine :: IO Int
  ts <- fmap (map read . words) getLine :: IO [Int]
  print $ solve ss ts 0

solve :: [Int] -> [Int] -> Int -> Int
solve _ [] n = n
solve ss (t:ts) n = solve ss ts $ n + if elem t ss then 1 else 0

