import Data.Array.Unboxed

binarySearch :: Int -> (Int, Int) -> UArray Int Int -> Bool
binarySearch target (start, end) arr
  | start == end    = target == arr!i
  | target == arr!i = True
  | target < arr!i  = binarySearch target (start, i) arr
  | otherwise       = binarySearch target (i+1, end) arr
  where i = floor $ (fromIntegral (end + start)) / 2

main = do
  n <- fmap read getLine
  seqNum <- fmap (map read . words) getLine
  let arr = listArray (1, n) seqNum
  _ <- getLine
  targets <- fmap (map read . words) getLine
  putStrLn $ show . length . filter (\x -> binarySearch x (1, n) arr) $ targets