#include using namespace std; #define rep(i,n) for(int i = 0;i<((int)(n));i++) #define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++) #define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--) #define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--) typedef long long ll; typedef pair mp; ll mod = 1e9+7; //LLONG_MIN /* やばい */ ll n,d[100010],inf=1e18,ans=0,s=1; vector v[100010]; queue Q; void f(ll p){ if(v[p].size()>1)ans+=v[p].size()-2; for(ll q:v[p]){ if(d[q]==d[p]+1){ f(q); } } } int main(void){ cin>>n; rep(i,n-1){ ll a,b; cin>>a>>b; v[a].push_back(b); v[b].push_back(a); } reg(i,1,n){ if(v[i].size()==1){ s=i; break; } } reg(i,1,n)d[i]=inf; queue Q; Q.push(s); d[s]=0; while(!Q.empty()){ ll p=Q.front();Q.pop(); for(ll q:v[p]){ if(d[q]>d[p]+1){ d[q]=d[p]+1; Q.push(q); } } } // cout<