import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] counts = new int[n]; for (int i = 0; i < n - 1; i++) { int a = sc.nextInt() - 1; int b = sc.nextInt() - 1; counts[a]++; counts[b]++; } int total = 0; for (int x : counts) { if (x > 2) { total += x - 2; } } System.out.println(total); } }