// yukicoder: 806 木を道に // 2019.5.12 bal4u #include #if 1 #define gc() getchar_unlocked() #else #define gc() getchar() #endif int in() // 非負整数の入力 { int n = 0, c = gc(); do n = 10 * n + (c & 0xf), c = gc(); while (c >= '0'); return n; } int hi[100005]; int main() { int i, N, ans; N = in(); for (i = 1; i < N; i++) hi[in()]++, hi[in()]++; ans = 0; for (i = 1; i <= N; i++) if (hi[i] > 2) ans += hi[i]-2; printf("%d\n", ans); return 0; }