import java.io.*; import java.util.Scanner; public class Main_yukicoder806 { private static Scanner sc; private static Printer pr; private static void solve() { int n = sc.nextInt(); int[] cnt = new int[n]; for (int i = 0; i < n - 1; i++) { int a = sc.nextInt() - 1; int b = sc.nextInt() - 1; cnt[a]++; cnt[b]++; } int ans = 0; for (int e : cnt) { ans += Math.max(0, e - 2); } pr.println(ans); } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(System.in); pr = new Printer(System.out); solve(); pr.close(); sc.close(); } static class Printer extends PrintWriter { Printer(OutputStream out) { super(out); } } }