#include using namespace std; vector graph[100010]; int vi[100010] = {}; int dfs(int idx){ vi[idx] = 1; bool flag = false; int ans = 0; for(int i = 0;i < graph[idx].size();i++){ if(vi[graph[idx][i]] == 0){ flag = true; ans += dfs(graph[idx][i]); } } if(flag){ return ans; }else{ return 1; } } int main(){ int n; cin >> n; int a, b; for(int i = 0;i < n-1;i++){ cin >> a >> b; a--, b--; graph[a].push_back(b); graph[b].push_back(a); } int used[100010] = {}; int root = 0; bool flag; do{ flag = false; used[root] = 1; for(int i = 0;i < graph[root].size();i++){ if(used[graph[root][i]] == 0){ flag = true; root = graph[root][i]; break; } } }while(flag); cout << dfs(root)-1 << endl; return 0; }