#include using namespace std; using Graph = vector>; vector used; void dfs(const Graph &a, int v, int p) { bool exit = false; for (auto ch : a[v]) { if (ch == p) continue; dfs(a, ch, v); if (used[ch]) exit = true; } if (!exit) used[v] = true; } void solved() { int n; cin >> n; Graph a(n + 1); for (int i = 1; i < n; i++) { int u, v; cin >> u >> v; a[u].emplace_back(v); a[v].emplace_back(u); } used.assign(n + 1, false); dfs(a, 1, -1); int ans = 0; for (int i = 1; i <= n; i++) { if (used[i]) ans++; } cout << ans << endl; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); /*int t = 1; cin >> t; while (t--)*/ solved(); return 0; }