#include #include #include using namespace std; vector visited; vector used; void dfs(vector > &graph, int i){ visited[i] = true; bool used_flg = true; for (int j : graph[i]){ if (visited[j]) continue; dfs(graph, j) ; if (used[j]) used_flg=false; } used[i] = used_flg; } int main() { int N; cin >> N; vector > graph(N); for (int i = 1; i < N; i++) { int a, b; cin >> a >> b; graph[a - 1].push_back(b - 1); graph[b - 1].push_back(a - 1); } used.assign(N, false); visited.assign(N, false); dfs(graph,0); int ans = 0; for (auto i:used){ if (i) ans++; } cout << ans << endl; return 0; }