#include using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) using Graph = vector>; vector seen; vector dp_del; vector dp_rem; void dfs(const Graph &G, int v) { seen[v] = true; for (auto next_v : G[v]) { if (seen[next_v]) continue; dfs(G, next_v); dp_del[v] += max(dp_rem[next_v],dp_del[next_v]); dp_rem[v] += dp_del[next_v]; } } int main(){ int n; cin >> n; Graph g(n); vector u(n-1),v(n-1); rep(i,n-1) { cin >> u[i] >> v[i]; u[i]--,v[i]--; g[u[i]].push_back(v[i]); g[v[i]].push_back(u[i]); } seen.assign(n,false); dp_del.assign(n,0); dp_rem.assign(n,1); dfs(g,0); cout << max(dp_del[0],dp_rem[0]) << endl; return 0; }