main = do
  getLine -- discard
  a_tops <- map (\x -> read x :: Int) . words <$> getLine 
  b_mids <- map (\x -> read x :: Int) . words <$> getLine 
  c_btms <- map (\x -> read x :: Int) . words <$> getLine 
  let answers = [ [a,b,c] | a <- a_tops, b <- b_mids, c <- c_btms, (a < b) && (b < c) ]
  print $ length answers
