import Data.List

main = do
  getLine -- discard 
  a_tops <- sort . map (\x -> read x :: Int) . words <$> getLine
  b_mids <- sort . map (\x -> read x :: Int) . words <$> getLine
  c_btms <- sort . map (\x -> read x :: Int) . words <$> getLine
  print $ sum $ map (\b -> (length $ takeWhile (<b) a_tops)*(length $ dropWhile (<=b) c_btms)) b_mids
