#include using namespace std; #ifdef LOCAL_DEBUG #include "LOCAL_DEBUG.hpp" #endif #define int long long signed main(){ int n; cin >> n; vector> G(n); vector indeg(n, 0); for(int i = 0; i < n-1; i++){ int a, b; cin >> a >> b; a--, b--; G[a].push_back(b); G[b].push_back(a); indeg[a]++; indeg[b]++; } int s = 0; for(int i = 0; i < n; i++){ if(indeg[i] == 1){ s = i; break; } } int ans = 0; function< void(int,int) > dfs = [&](int u, int pre){ int child = 0; for(int v : G[u]){ if(v == pre) continue; dfs(v, u); child++; } if(child == 0) return; ans += child - 1; }; dfs(s, -1); cout << ans << endl; return 0; }