#include using namespace std; typedef long long ll; typedef unsigned long long ull; #define REP(i, n) for(int i=0; ibool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b G[100100]; void dfs(int v, int p, vector>& dp){ dp[v][0] = 1; dp[v][1] = 0; for(auto& nv : G[v]){ if(nv == p) continue; dfs(nv, v, dp); dp[v][0] += max(dp[nv][0]-1, dp[nv][1]); dp[v][1] += max(dp[nv][0], dp[nv][1]); } } int main(){ int N; cin >> N; REP(i,N-1){ int u, v; cin >> u >> v; u--, v--; G[u].push_back(v); G[v].push_back(u); } vector> dp(N, vector(2)); dfs(0, -1, dp); ll ans = max(dp[0][0], dp[0][1]); cout << ans << endl; return 0; }