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
    candidate = [(a,b,c) | a<-as,b<-bs,c<-cs,a<b&&b<c]
    ans = length candidate
  
