import Data.List
import qualified Data.ByteString.Char8 as BC
import Data.Maybe (fromJust)
import Control.Monad
import Data.Functor

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

main :: IO()
main = do
  _ <- fmap read getLine :: IO Int
  ss <- readInts
  _ <- fmap read getLine :: IO Int
  ts <- readInts
  print $ solve ss ts

solve :: [Int] -> [Int] -> Int
solve ss ts = length . filter (\t -> elem t ss) $ ts

binarySearch :: Int -> [Int] -> Int -> Int -> Bool
binarySearch t ss b e
  | t == mid = True
  | b == e || b > e  = False
  | t < mid = binarySearch t ss b (i - 1)
  | t > mid = binarySearch t ss (i + 1) e
  where
    i = div (b + e) 2
    mid = ss !! i

