module Main where

import Control.Applicative
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B

readi b | Just (n, _) <- B.readInt b = n

solve :: [Int] -> [Int] -> [Int] -> Int
solve []     _  _  = 0
solve (a:as) bs cs
    | null bs'  = 0
    | otherwise = solve' bs' cs + solve as bs' cs
  where
    bs' = dropWhile (<= a) bs

solve' :: [Int] -> [Int] -> Int
solve' []     _  = 0
solve' (a:as) bs
    | null bs'  = 0
    | otherwise = length bs' + solve' as bs'
  where
    bs' = dropWhile (<= a) bs

main :: IO ()
main = do
    getLine
    as <- sort . fmap readi . B.words <$> B.getLine :: IO [Int]
    bs <- sort . fmap readi . B.words <$> B.getLine :: IO [Int]
    cs <- sort . fmap readi . B.words <$> B.getLine :: IO [Int]
    print $ solve as bs cs