import Control.Applicative
import Data.Array

bs :: Array Int Int -> Int -> Int -> Bool
bs xs x m = bs' 0 (m-1)
    where
    bs' a b
     |  midVal == x = True
     |  a >= b      = False
     |  midVal < x  = bs' (mid+1) b
     |  midVal > x  = bs' a (mid-1)
        where
            mid    = div (a+b) 2
            midVal = xs ! mid

main = do
    n <- readLn :: IO Int
    s <- (array (0,n-1) . (zip [0..] . map read . words)) <$> getLine :: IO (Array Int Int)
    _ <- readLn :: IO Int
    t <- (map read . words) <$> getLine :: IO [Int]
    putStrLn . show . foldl (\a b -> if bs s b n then a+1 else a) 0 $ t

