#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
const int MAXN=2E5+1;
 
int cnt=0;
vector<ll>g[MAXN];
vector<ll>vis(MAXN,0);
 
void dfs(int node,int par){
    for(auto &c:g[node]){
        if(c != par){
            dfs(c,node);
            if(!vis[node] && !vis[c]){
                //this edge bw node and c should be a part of matching set
                cnt++;
                vis[node]=vis[c]=1;
            }
        }
    }
}
 
void _144()
{
    ll n;
    cin>>n;
 
    for(int i=1;i<=n-1;i++){
        ll a,b;
        cin>>a>>b;
 
        g[a].push_back(b);
        g[b].push_back(a);
    }
 
    dfs(1,-1);
 
    cout<<cnt;
    return;
}
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
 
    int t=1;
    // cin >> t;
 
    while (t--) _144();
    return 0;
}