module Main where
-- import Debug.Trace
import Data.List
import qualified Data.Sequence as S
import qualified Data.ByteString.Char8 as B
import Data.Int
import Data.Char
import Data.Array
import Data.Maybe
-- import qualified Data.Map as M
import Data.Ord
import Data.Functor
import Control.Applicative
import Control.Monad

solve :: [Int] -> [Int] -> Int
solve s t = length (intersect t s)

readLine :: IO [Int]
readLine = map (fst . fromJust . B.readInt) . B.words <$> B.getLine

main :: IO() 
main = do
    n <- readLn :: IO Int
    s <- readLine
    q <- readLn :: IO Int
    t <- readLine
    print $ solve s t

