#include <bits/stdc++.h>   using namespace std;   vector<int> adj[200001];   int dis[200001];   int par[200001];   void addEdge(int u, int v) {     adj[u].push_back(v);     adj[v].push_back(u);   }   void dfs(int src, int parent, int dist) {     dis[src] = dist;     par[src] = parent;     for (int child : adj[src]) {       if (child != parent) {         dfs(child, src, dist + 1);       }     }   }   int solve() {     int n;     cin >> n;     int u, v;     for (int i = 0; i < n - 1; i++) {       cin >> u >> v;       addEdge(u, v);     }     dfs(1, 0, 0);     set<pair<int, int> > st;     for (int i = 1; i <= n; i++) {       if (dis[i] > 2) {         st.insert({-dis[i], i});       }     }     int ans = 0;     while (!st.empty()) {       int rmv = (*st.begin()).second;       st.erase(st.begin());       rmv = par[rmv];       auto itr = st.find({-dis[rmv], rmv});       if (itr != st.end()) st.erase(itr);       for (int c : adj[rmv]) {         if (dis[c] > 2) {           itr = st.find({-dis[c], c});           if (itr != st.end()) st.erase(itr);         }       }       ans++;     }     return ans;   }   int main() { cout << solve() <<   n ; }   