import Control.Monad
import qualified Data.ByteString.Char8 as BC
import Data.Maybe (fromJust)

readInts :: IO [Int]
readInts = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

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 readInts
  print $ countSaidan (parts !! 0) (parts !! 1) (parts !! 2)
