import scala.io.StdIn._ object Main{ def main(args: Array[String]): Unit ={ val n : Int = readLine().toInt val degrees : Array[Int] = Array.fill(n)(0) for(_ <- 1 until n){ val Array(a, b) : Array[Int] = readLine().split(' ').map(_.toInt) degrees(a-1) += 1 degrees(b-1) += 1 } var ans : Int = 0 for(i <- 0 until n){ ans += math.max(0, degrees(i)-2) } println(ans) } }