module Main where
import qualified Control.Monad as C
import qualified Data.Char as C
import qualified Data.List as L
import qualified Data.Map as M
import qualified Data.Array as A

int = read :: String -> Int
getWord :: IO String
getWord = do
  c <- getChar
  if C.isSpace c
  then
    return []
  else do
    ws <- getWord
    return (c:ws)
getInt = fmap int getWord
replace pred a = map (\x -> if pred x then a else x)

main = interact $ printer . solver . parser
parser :: String -> [String]
parser = tail . lines 
printer :: Int -> String
printer = (++"\n") . show

solver [[],[],[]] = 0
solver [a:as,b:bs,c:cs] = calc a b c + solver[as,bs,cs]



calc a b c 
  | a==b && b==c = 0
  | a==b && b/=c = 1
  | b==c && c/=a = 1
  | c==a && a/=b = 1
  | otherwise = 2
