#include using namespace std; typedef long long ll; typedef vector vi; typedef vector vl; typedef pair pii; typedef pair pll; typedef int _loop_int; #define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i) #define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i) #define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i) #define DEBUG(x) cout<<#x<<": "< P; int n; vi g[125252]; int dist[125252]; void dfs(int p, int bef, int d){ dist[p] = d; for(int to : g[p])if(to != bef){ dfs(to,p,d+1); } } int dfs2(int p, int bef){ int ret = 0; bool first = true; for(int to : g[p])if(to!=bef){ ret += dfs2(to,p); if(first){ first = false; }else{ ret++; } } return ret; } int main(){ scanf("%d",&n); REP(i,n-1){ int a,b; scanf("%d%d",&a,&b);--a;--b; g[a].push_back(b); g[b].push_back(a); } dfs(0,-1,0); int x = max_element(dist,dist+n) - dist; printf("%d\n",dfs2(x,-1)); return 0; }