import           Control.Applicative
import           Control.Monad

import           Data.Array.IArray
import           Data.Array.Unboxed

binarySearch :: Int -> UArray Int Int -> Bool
binarySearch n ary = uncurry go (bounds ary)
  where
    go left right
        | left > right = False
        | midv == n    = True
        | midv <  n    = go (mid + 1) right
        | midv >  n    = go left (mid - 1)
      where
        mid = (left + right) `div` 2
        midv = ary ! mid

main :: IO ()
main = do
    getLine
    ss <- fmap read . words <$> getLine :: IO [Int]
    getLine
    ts <- fmap read . words <$> getLine :: IO [Int]
    let ary = listArray (0, length ss - 1) ss :: UArray Int Int
    print . length $ filter (flip binarySearch ary) ts

