func_code_string: #include <bits/stdc++.h>   using namespace std;   using ll = long long;   using ld = double;   using pll = pair<ll, ll>;   using vll = vector<ll>;   using vpll = vector<pll>;   using vvll = vector<vll>;   vector<vector<ll>> g;   vector<bool> v;   ll res;   pair<bool, bool> dfs(int u, int depth) {     v[u] = true;     if (depth > 2 && g[u].size() == 1) return make_pair(false, false);     bool inSet = false;     bool isDominated = false;     for (ll i = 0; i < (ll)g[u].size(); ++i) {       if (v[g[u][i]]) continue;       auto t = dfs(g[u][i], depth + 1);       inSet |= !t.first;       isDominated |= t.second;     }     if (depth <= 1) return make_pair(true, true);     if (inSet) res++;     return make_pair(isDominated || inSet, inSet);   }   int main() {     ios::sync_with_stdio(0);     cout.tie(0);     cin.tie(0);     ll n;     cin >> n;     g = vector<vector<ll>>(n);     v = vector<bool>(n);     for (ll i = 0; i < (ll)n - 1; ++i) {       ll u, v;       cin >> u >> v;       u--;       v--;       g[u].push_back(v);       g[v].push_back(u);     }     dfs(0, 0);     cout << res << endl;     return 0;   }   