#include<bits/stdc++.h>
using namespace std;
#define VI vector<int>
#define PII pair<int, int>
#define VPI vector<PII>
#define mp make_pair
#define eb emplace_back
#define pb push_back
#define st first
#define nd second
#define endl '\n'
#define debug(x) cerr << #x << " " << x << endl;
#define ll long long

//#define int ll

const int N = 1e6 + 7;

int n;

int t[N];

void solve(){
	cin >> n;
	
	if (n == 1){
		cout << 0;
		return;
	}
	
	for(int i = 1; i < n; i++){
		int a,b;
		cin >> a >> b;
		
		t[a]++;
		t[b]++;
	}
	
	int res = 0;
	
	for(int i = 1; i <= n; i++){
		res += (t[i] == 1);
	}
	
	cout << res - 2;
}

int32_t main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	int test = 1;
	
	while(test--){
		solve();
	}
	
	return 0;
}

