#include #include #include using namespace atcoder; using mint = modint1000000007; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 1000000001 struct lca{ vector depth; vector> parents; int max_j=18; lca(int n,vector> &E){ depth.assign(E.size(),-1); parents.assign(E.size(),vector(max_j,-1)); rep(i,100){ if((1<E.size()){ max_j = i; break; } } stack s; s.push(n); depth[n] = 0; while(s.size()!=0){ int k = s.top(); s.pop(); for(int i=0;i=0;i--){ if(parents[u][i]!=parents[v][i]){ u = parents[u][i]; v = parents[v][i]; } } return parents[u][0]; } int get_distance(int u,int v){ return depth[u]+depth[v]-2*depth[query(u,v)]; } }; int main(){ int N; cin>>N; vector> E(N); rep(i,N-1){ int u,v; cin>>u>>v; u--;v--; E[u].push_back(v); E[v].push_back(u); } lca L(0,E); int t = 0; rep(i,N){ if(L.get_distance(0,i)%2==1)t++; } t = min(t,N-t); cout<