import qualified Data.Set as Set

main = do
  s' <- getContents
  let s1 = Set.fromList $ map (read :: String -> Int) $ words $ (lines s') !! 1
  let s2 = Set.fromList $ map (read :: String -> Int) $ words $ (lines s') !! 3
  print $ Set.size $ Set.intersection s2 s1