import qualified Data.Vector as V (Vector, fromList, length, (!))
import Control.Applicative


binarySearch :: V.Vector Int -> Int -> Bool
binarySearch vec a = loop (0, V.length vec - 1)
  where
    loop (start, end)
      | v == a       = True
      | start >= end = False
      | v > a        = loop (start, n - 1)
      | v < a        = loop (n + 1, end)
      where
        (n, v) = (div (start + end) 2, vec V.! n)

main :: IO ()
main = do
  _ <- getLine
  s <- map read . words <$> getLine
  _ <- getLine
  t <- map read . words <$> getLine
  print $ length $ filter (binarySearch $ V.fromList s) t

