import           Data.List
import           Control.Applicative
import           Control.Monad
import           Control.Monad.State

gacha :: Ord a => [a] -> [a] -> [(a, a)]
gacha [] _  = []
gacha _  [] = []
gacha (x : xs) (y : ys) | x == y    = (x, y) : gacha xs ys
                        | x < y     = gacha xs (y : ys)
                        | otherwise = gacha (x : xs) ys

binarySearch :: Ord a => a -> [a] -> Bool
binarySearch a []  = False
binarySearch a [t] = a == t
binarySearch a xs | head l == a = True
                  | head r == a = True
                  | head r > a  = binarySearch a l
                  | otherwise   = binarySearch a r
 where
  sz     = div (length xs) 2
  (l, r) = splitAt sz xs

main = do
  n <- readLn
  s <- take n . map (read :: String -> Int) . words <$> getLine
  q <- readLn
  t <- take q . map (read :: String -> Int) . words <$> getLine
  print $ length $ gacha s (sort t)

