import Data.List

main = do
  getLine
  a <- sort . map (read :: String -> Int) . words <$> getLine
  b <- sort . map (read :: String -> Int) . words <$> getLine
  c <- reverse . sort . map (read :: String -> Int) . words <$> getLine
  print $ sum . map (count a c) $ b


lt :: [Int] -> Int -> Int
lt a b = length $ takeWhile (< b) a

gt :: [Int] -> Int -> Int
gt c b = length $ takeWhile (> b) c

count :: [Int] -> [Int] -> Int -> Int
count a c b = (lt a b) * (gt c b)
