import Control.Monad

countSaidan :: Ord a => [a] -> [a] -> [a] -> Int
countSaidan as bs cs = length [(a, b, c) | a <- as, b <- bs, c <- cs, a < b, b < c]

main :: IO()
main = do
  n <- getLine
  parts <- replicateM 3 ((map (read :: String -> Integer) . words) <$> getLine)
  print $ countSaidan (parts !! 0) (parts !! 1) (parts !! 2)
