import qualified Data.Set as S

solve :: [Int] -> [Int] -> Int
solve ss ts = S.size $ S.intersection ss' ts' 
  where
    ss' = S.fromList ss
    ts' = S.fromList ts

  
readInt :: String -> Int
readInt = read

main = do
  n <- getLine 
  s <- fmap (map readInt . words) getLine 

  q <- getLine 
  t <- fmap (map readInt . words) getLine 

  let ans = solve s t 
  print ans

