1 #include<cstdio>
2 #include<cstring>
3 #include<algorithm>
4 const int N=1e4+10;
5 struct node{int ne,to;}e[N*2];
6 struct point{int num,id;}q[N];
7 int n,first[N],tot=0;
8 bool ok[N];
9 bool cmp(point x,point y){return x.num>y.num;}
10 int read(){
11 int ans=0,f=1;char c=getchar();
12 while(c<‘0‘||c>‘9‘){if(c==‘-‘)f=-1;c=getchar();}
13 while(c>=‘0‘&&c<=‘9‘){ans=ans*10+c-48;c=getchar();}
14 return ans*f;
15 }
16 int ans=0;
17 void ins(int u,int v){e[++tot]=(node){first[u],v};first[u]=tot;}
18 void insert(int u,int v){ins(u,v);ins(v,u);}
19 void dfs(int x,int fa){
20 bool flag=0;
21 for(int i=first[x];i;i=e[i].ne){
22 int to=e[i].to;
23 if(to!=fa)dfs(to,x);
24 if(ok[to])flag=1;
25 }
26 if(!flag&&!ok[x]&&!ok[fa]){
27 ok[fa]=1;ans++;
28 }
29 }
30 int main(){
31 n=read();
32 for(int i=1;i<n;i++)
33 insert(read(),read());
34 dfs(1,0);
35 printf("%d",ans);
36 return 0;
37 }