module Main where
import qualified Data.Set as S

main :: IO ()
main = do
    n <- fmap read getLine :: IO Int
    a <- getLine
    b <- getLine
    c <- getLine
    let ans = sum $ zipWith3 f a b c
        f x y z = d - 1
            where
            d = S.size $ S.fromList [x,y,z]
    print ans
