#include using namespace std; using Pi = pair; using Pii = pair; using vint = vector; int N; vint G[100010]; int far[100010]; int far_idx[100010]; int cost[100010]; void dfs(int u, int p) { far[u] = 0; far_idx[u] = u; for(int v : G[u]) { if(v == p) continue; dfs(v, u); if(far[u] < far[v]+1) { far[u] = far[v] + 1; far_idx[u] = far_idx[v]; } } cost[u] = 0; for(int v : G[u]) { if(v == p) continue; cost[u] += cost[v] + (far_idx[v]!=far_idx[u]); } } int main() { cin >> N; for(int i = 0; i < N-1; ++i) { int a, b; cin >> a >> b; --a, --b; G[a].push_back(b); G[b].push_back(a); } dfs(0, -1); cout << cost[0] - (G[0].size()>1) << endl; }