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

import Debug.Trace


binarySearch :: (V.Vector Int, Int, Int) -> Int -> Bool
binarySearch (vec, s, e) a
  | v == a = True
  | s >= e = False
  | v >  a = binarySearch (vec, s, n - 1) a
  | v <  a = binarySearch (vec, n + 1, e) a
  where
    n = div (s + e) 2
    v = vec V.! n

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

