solve :: String -> String -> String -> Int
solve [] [] [] = 0
solve (a1:ax) (b1:bx) (c1:cx)
  | a1 == b1 && b1 == c1             =     solve ax bx cx
  | a1 == b1 || b1 == c1 || a1 == c1 = 1 + solve ax bx cx
  | otherwise                        = 2 + solve ax bx cx

main :: IO ()
main = do
  _ <- getLine
  a <- getLine
  b <- getLine
  c <- getLine
  print $ solve a b c