{-# OPTIONS_GHC -O #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ViewPatterns #-}

import Control.Monad
import Data.List
import Data.Ord (comparing)
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed as UV

bsearch f (a,b)
    | a+1 == b = a
    | f m  = bsearch f (m,b)
    | True = bsearch f (a,m)
    where m = (a + (b-a)`div`2)

go n as cs j = (na+1) * (n-1 - nc)
    where na = bsearch (\i -> as UV.! i < j) (-1, n)
          nc = bsearch (\i -> cs UV.! i <= j) (-1, n)

main = do
    n <- readLn :: IO Int
    as <- UV.fromList.sort.unfoldr (B.readInt.B.dropWhile (==' ')) <$> B.getLine
    --
    bs <- sort.unfoldr (B.readInt.B.dropWhile (==' ')) <$> B.getLine
    --
    cs <- UV.fromList.sort.unfoldr (B.readInt.B.dropWhile (==' ')) <$> B.getLine
    --
    print $ sum $ map (go n as cs) bs
