#include using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; template using vc = vector; template using vvc = vc>; using pi = pair; using pl = pair; using vi = vc; using vvi = vvc; using vl = vc; using vvl = vvc; #define rep(i,a,b) for (int i = (int)(a); i < (int)(b); i++) #define irep(i,a,b) for (int i = (int)(a); i > (int)(b); i--) #define all(a) a.begin(),a.end() #define print(n) cout << n << '\n' #define pritn(n) print(n) #define printv(n,a) {copy(all(n),ostream_iterator(cout," ")); cout<<"\n";} #define printvv(n,a) {for(auto itr:n) printv(itr,a);} #define rup(a,b) (a+b-1)/b #define input(A,N) rep(i,0,N) cin>>A[i] #define chmax(a,b) a = max(a,b) #define chmin(a,b) a = min(a,b) template< typename T > struct edge{ int from,to; T cost; /* *to:繋がってる先 *cost:辺のコスト */ edge(int from,int to, T cost):from(from),to(to),cost(cost){}; edge &operator=(const int& x){ to = x; return *this; } }; template< typename T > struct graph{ int n; vector>> e; graph(int n):n(n),e(n){} void addedge(int from,int to,T cost){ e[from].emplace_back(from,to,cost); } vector> &operator[](int i) { return e[i]; } }; void dfs(int ni,int par,vvi&dp,graph&g){ for(auto e:g[ni]){ if(par==e.to) continue; dfs(e.to,ni,dp,g); dp[ni][0] += max(dp[e.to][0],dp[e.to][1]); dp[ni][1] += dp[e.to][0]; } dp[ni][1] ++; return ; } int main(){ cout << fixed << setprecision(15); int n; cin>>n; graph g(n); rep(i,0,n-1){ int u,v; cin>>u>>v; u--;v--; g.addedge(u,v,1); g.addedge(v,u,1); } vvi dp(n,vi(2,0)); dfs(0,-1,dp,g); print(max(dp[0][0],dp[0][1])); //system("pause"); return 0; }