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

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

countSaidan :: [Int] -> [Int] -> [Int] -> Int
countSaidan a b c = sum allSaidan
  where
    as = DL.sort a
    bs = DL.sort b
    cs = DL.sort c
    bs_over_as = map (flip dropWhile bs . (>=)) as
    allSaidan = map (sum . map (length . flip dropWhile cs . (>=))) bs_over_as

main :: IO()
main = do
  n <- getLine
  parts <- replicateM 3 readInts
  print $ countSaidan (parts !! 0) (parts !! 1) (parts !! 2)
