import Control.Monad import Data.List main = do n <- (read :: String -> Int) <$> getLine s <- replicateM (n-1) ((map read :: [String] -> [Int]) . words <$> getLine) print (solve s) solve :: [[Int]] -> Int solve xs = foldl (\n v -> (max (length v - 2) 0) + n) 0 (group $ sort $ concat xs)