import Data.List

main = do
    _ <- getLine
    as <- sort . map read . words <$> getLine :: IO [Int]
    bs <- sort . map read . words <$> getLine
    cs <- sort . map read . words <$> getLine
    let solve ([]:_) = 0
        solve (zs:[]) = length zs
        solve ((x:xs):ys:ns) = let ys' = dropWhile (<=x) ys in (solve (xs:ys':ns)) + (solve (ys':ns))
    print $ solve [as,bs,cs]
