import Data.List
 
main = do
  getLine
  as <- readSortedInts
  bs <- readSortedInts
  cs <- readSortedInts
  print $ solve as bs cs

readSortedInts :: IO [Int]
readSortedInts = sort . map read . words <$> getLine
 
solve as [b] cs = (length as') * (length cs')
  where
    as' = takeWhile (< b) as
    cs' = takeWhile (< b) cs
solve as (b:bs) cs = (length as') * (length bs) * (length cs') + solve as'' bs cs''
  where
    (as', as'') = span (< b) as
    (cs', cs'') = span (< b) cs