#include<bits/stdc++.h>
#define hell 1000000007
#define lcm(a,b) (a*b)/__gcd(a,b)
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll vector< pair<ll,ll> >
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define lbnd lower_bound
#define ubnd upper_bound
#define bs binary_search
#define F first
#define S second
#define rep(i,a,b) for(i=a;i<b;i++)
#define parr(a,n) for(i=0;i<n;i++) cout<<a[i]<<" ";cout<<endl;
#define pcont(a) for(auto i:a) cout<<i<<" ";cout<<endl;
#define ret(x) return cout<<x,0;
#define dbg(x) cerr << #x << " is " << x << endl;
#define endl '\n'
using namespace std;
vll adj[100001];
bool vis[100001];
ll dp[100001];
stack<ll> st;
ll calc(ll s)
{
if(dp[s]!=-1)
return dp[s];
if(adj[s].size()==0)
return dp[s]=1;
ll inc=1,exc=0;
for(auto it:adj[s])
{
exc+=calc(it);
}
for(auto it:adj[s])
{
ll val=0;
for(auto jt:adj[it])
{
val+=calc(jt);
}
inc+=min(calc(it),val);
}
dp[s]=min(inc,exc);
return dp[s];
}
void dfs(ll i)
{
vis[i]=true;
for(auto it:adj[i])
{
if(!vis[it])
dfs(it);
}
st.push(i);
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);
ll i,j,n,t=1,k=0,cnt=0,mini=LLONG_MAX,maxi=LLONG_MIN,ans=0;
ll m;
cin>>n;
m=n-1;
rep(i,0,m)
{
cin>>j>>k;
adj[j].pb(k);
}
for(i=0;i<100001;i++)
dp[i]=-1;
memset(vis,false,sizeof(vis));
for(i=1;i<=n;i++)
{
if(!vis[i])
dfs(i);
}
ans=calc(st.top());
cout<<ans;
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KCiNkZWZpbmUgaGVsbCAgICAgICAgICAgICAgICAgICAgICAgICAxMDAwMDAwMDA3CiNkZWZpbmUgbGNtKGEsYikgICAgICAgICAgICAgICAgICAgICAoYSpiKS9fX2djZChhLGIpCiNkZWZpbmUgbGwgICAgICAgICAgICAgICAgICAgICAgICAgICBsb25nIGxvbmcKI2RlZmluZSB2bGwgICAgICAgICAgICAgICAgICAgICAgICAgIHZlY3RvcjxsbD4KI2RlZmluZSB2aSAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlY3RvcjxpbnQ+CiNkZWZpbmUgcGxsICAgICAgICAgICAgICAgICAgICAgICAgICB2ZWN0b3I8IHBhaXI8bGwsbGw+ID4KI2RlZmluZSBwYiAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1c2hfYmFjawojZGVmaW5lIG1wICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZV9wYWlyCiNkZWZpbmUgYWxsKHYpICAgICAgICAgICAgICAgICAgICAgICB2LmJlZ2luKCksdi5lbmQoKQojZGVmaW5lIGxibmQgICAgICAgICAgICAgICAgICAgICAgICAgbG93ZXJfYm91bmQKI2RlZmluZSB1Ym5kICAgICAgICAgICAgICAgICAgICAgICAgIHVwcGVyX2JvdW5kCiNkZWZpbmUgYnMgICAgICAgICAgICAgICAgICAgICAgICAgICBiaW5hcnlfc2VhcmNoCiNkZWZpbmUgRiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaXJzdAojZGVmaW5lIFMgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2Vjb25kCiNkZWZpbmUgcmVwKGksYSxiKSAgICAgICAgICAgICAgICAgICBmb3IoaT1hO2k8YjtpKyspCiNkZWZpbmUgcGFycihhLG4pICAgICAgICAgICAgICAgICAgICBmb3IoaT0wO2k8bjtpKyspIGNvdXQ8PGFbaV08PCIgIjtjb3V0PDxlbmRsOwojZGVmaW5lIHBjb250KGEpICAgICAgICAgICAgICAgICAgICAgZm9yKGF1dG8gaTphKSBjb3V0PDxpPDwiICI7Y291dDw8ZW5kbDsKI2RlZmluZSByZXQoeCkgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjb3V0PDx4LDA7CiNkZWZpbmUgZGJnKHgpICAgICAgICAgICAgICAgICAgICAgICBj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IG07CiAgICBjaW4+Pm47CiAgICBtPW4tMTsKICAgIHJlcChpLDAsbSkKICAgIHsKICAgICAgICBjaW4+Pmo+Pms7CiAgICAgICAgYWRqW2pdLnBiKGspOwogICAgfQogICAgZm9yKGk9MDtpPDEwMDAwMTtpKyspCiAgICAgICAgZHBbaV09LTE7CiAgICBtZW1zZXQodmlzLGZhbHNlLHNpemVvZih2aXMpKTsKICAgIGZvcihpPTE7aTw9bjtpKyspCiAgICB7CiAgICAgICAgaWYoIXZpc1tpXSkKICAgICAgICAgICAgZGZzKGkpOwogICAgfQogICAgYW5zPWNhbGMoc3QudG9wKCkpOwogICAgY291dDw8YW5zOwogICAgcmV0dXJuIDA7Cn0K