import Data.List

main = do
  _ <- read <$> getLine :: IO Int
  as <- map read . words <$> getLine :: IO [Int]
  bs <- map read . words <$> getLine :: IO [Int]
  cs <- map read . words <$> getLine :: IO [Int]
  print $ solve as bs cs

solve as bs cs =
  ans
  where
    as' = sort as
    bs' = sort bs
    cs' = sort cs
    ans = choose as' bs' cs' 0

choose [] _ _ acc = acc
choose (a:as) bs@(b:_) cs acc =
   choose as bs cs $ acc+len
  where
    bs' = takeWhile (>a) bs
    cs' = map (\b -> takeWhile (>b) cs) bs'
    len = length $ concat cs'
  