#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

int N;
vector<int> G[100010];

int root;
int par[100010];
vector<int> ch[100010];
vector<int> vs;
void dfs(int v,int p){
	par[v] = p;
	rep(i,G[v].size()){
		if(G[v][i] == p)continue;
		dfs(G[v][i],v);
		ch[v].pb(G[v][i]);
	}
	vs.pb(v);
}

int main(){
	static int a[100010],b[100010];
	scanf("%d",&N);
	for(int i = 0 ; i < N-1 ; i ++){
		scanf("%d%d",&a[i],&b[i]);
		G[a[i]].pb(b[i]);
		G[b[i]].pb(a[i]);
	}
	
	root = -1;
	for(int i = 0 ; i < N ; i ++){
		if(G[i].size() == 1){
			root = i;
			break;
		}
	}
	/*if(root == -1){
		puts("1");
		return 0;
	}*/
	dfs(root,-1);
	
	static int dp[100010][2] = {};
	for(int i = 0 ; i < vs.size() ; i ++){
		int v = vs[i];
		if(v != root){
			if(ch[v].size() >= 2){
				for(int j = 0 ; j < ch[v].size() ; j ++){
					dp[v][0] += max( dp[ch[v][j]][1] , 1 );
				}
			}
			if(ch[v].size() == 1){
				dp[v][0] = dp[ch[v][0]][0];
			}
			if(ch[v].size() == 0){
				dp[v][0] = 1;
			}
			if(ch[v].size() >= 2){
				int cnt = 0;
				for(int j = 0 ; j < ch[v].size() ; j ++){
					dp[v][1] += dp[ch[v][j]][1];
					if(dp[ch[v][j]][1] == 0)cnt ++;
				}
				dp[v][1] += max( cnt-1 , 0 );
			}
			/*if(ch[v].size() == 2){
				int ch0 = ch[v][0];
				int ch1 = ch[v][1];
				dp[v][1] = min( dp[ch0][1] + dp[ch1][0] , dp[ch0][0] + dp[ch1][1] );
			}*/
			if(ch[v].size() == 1){
				dp[v][1] = dp[ch[v][0]][1];
			}
		}
		else {
			break;
			if(ch[v].size() >= 2){
				for(int j = 0 ; j < ch[v].size() ; j ++){
					dp[v][0] += max( dp[ch[v][j]][1] , 1 );
				}
			}
			if(ch[v].size() == 1){
				dp[v][0] = dp[ch[v][0]][0];
			}
			if(ch[v].size() >= 3){
				int cnt = 0;
				for(int j = 0 ; j < ch[v].size() ; j ++){
					dp[v][1] += dp[ch[v][j]][1];
					if(dp[ch[v][j]][1] == 0)cnt ++;
				}
				dp[v][1] += max( cnt-1 , 0 );
			}
			if(ch[v].size() == 2){
				int ch0 = ch[v][0];
				int ch1 = ch[v][1];
				dp[v][1] = dp[ch0][0] + dp[ch1][0] ;
				dp[v][1] = min( dp[v][1] , max( dp[ch0][0] , 1 ) + dp[ch1][1] );
				dp[v][1] = min( dp[v][1] , max( dp[ch1][0] , 1 ) + dp[ch0][1] );
				dp[v][1] = min( dp[v][1] , max( dp[ch0][0] , 1 ) + max( dp[ch1][0] , 1 ) );
				if(dp[v][1] == 0)dp[v][1] = 1;
			}
			if(ch[v].size() == 1){
				dp[v][1] = dp[ch[v][0]][1];
			}
		}
	}
	
	cout << min( dp[G[root][0]][0] , dp[G[root][0]][1] + 1 ) << endl;
}



Measured memory_bytes: 18168