import           Control.Applicative ((<$>))
import qualified Data.Set            as S

main :: IO ()
main = do
    _ <- getLine
    s <- S.fromList . map read . words <$> getLine :: IO (S.Set Int)
    _ <- getLine
    t <- S.fromList . map read . words <$> getLine :: IO (S.Set Int)
    print $ S.size $ S.intersection s t