import java.util.*; class Main{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k[] = new int[n]; for(int i = 1; i <= n-1; i++){ k[sc.nextInt()-1]++; k[sc.nextInt()-1]++; } Arrays.sort(k); int ans = 0; for(int i = 2; i < n-1; i++){ if(k[i] < 2){ for(int j = i+1; j < n; j++){ if(k[j] > 2){ k[i]++; k[j]++; ans++; } } Arrays.sort(k); i=1; } } System.out.print(ans); } }