#include using namespace std; #define ll long long #define rep(i, n) for (int i = 0; i < (n); i++) #define P pair #define LP pair #define fi first #define se second #define pb push_back #define eb emplace_back #define all(s) s.begin(), s.end() #define rall(s) s.rbegin(), s.rend() template void chmax(T& a, T b) { a = max(a, b); }; template void chmin(T& a, T b) { a = min(a, b); }; int n; vector g[100005]; int dp[100005][2]; void dfs(int v, int p = -1) { dp[v][1] = 1; int tmp0 = 0, tmp1 = 0; for (int nv : g[v]) { if (nv == p) continue; dfs(nv,v); tmp0 += max(dp[nv][0],dp[nv][1]); tmp1 += max(dp[nv][0], dp[nv][1]-1); } dp[v][0] += tmp0; dp[v][1] += tmp1; } int main() { cin >> n; rep(i,n-1) { int u, v; cin >> u >> v; u--, v--; g[u].pb(v); g[v].pb(u); } dfs(0); cout << max(dp[0][0], dp[0][1]) << endl; return 0; }