import Data.List
import Control.Monad

main = do
    (_:a:b:c:[]) <- (replicateM 4 getLine) >>= return . map (tail . words)
    putStrLn . show . length $ (c \\ a) ++ (a `intersect` b `intersect` c)

