#include <bits/stdc++.h>
using namespace std;
#define maxx 100009
#define pb push_back
#define pii pair<int,int>
queue<int>q;
vector<pii>vpii[maxx];
#define inf 0x7fffffff
int X[]={+2,+2,-2,-2,+1,-1,-1,+1};
int Y[]={-1,+1,-1,+1,+2,+2,-2,-2};
map<char,int>cost;
vector<int>v[maxx];
int vis[maxx];
enum{notvisited,black,white};
int b=0,w=0;
void bfs(int src)
{
vis[src]=black;
b++;
queue<int>q;
q.push(src);
while(!q.empty()){
int s=q.front();
q.pop();
for(int i=0;i<v[s].size();i++){
if(vis[v[s][i]]==notvisited)
{
if(vis[s]==black)
{
vis[v[s][i]]=white;
w++;
}
else if(vis[s]==white)
{
vis[v[s][i]]=black;
b++;
}
q.push(v[s][i]);
}
}
}
}
int main() {
int n;
scanf("%d",&n);
int m=n-1,x;
while(m--){
int a,b;
scanf("%d %d",&a,&b);
v[a].pb(b);
v[b].pb(a);
x=a;
}
bfs(x);
printf("%d\n",min(b,w));
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgbWF4eCAxMDAwMDkKI2RlZmluZSBwYiBwdXNoX2JhY2sKI2RlZmluZSBwaWkgcGFpcjxpbnQsaW50PgpxdWV1ZTxpbnQ+cTsKdmVjdG9yPHBpaT52cGlpW21heHhdOwojZGVmaW5lIGluZiAweDdmZmZmZmZmCmludCBYW109eysyLCsyLC0yLC0yLCsxLC0xLC0xLCsxfTsKaW50IFlbXT17LTEsKzEsLTEsKzEsKzIsKzIsLTIsLTJ9OwptYXA8Y2hhcixpbnQ+Y29zdDsKdmVjdG9yPGludD52W21heHhdOwppbnQgdmlzW21heHhdOwplbnVte25vdHZpc2l0ZWQsYmxhY2ssd2hpdGV9OwppbnQgYj0wLHc9MDsKdm9pZCBiZnMoaW50IHNyYykKewogICAgdmlzW3NyY109YmxhY2s7CiAgICBiKys7CiAgICBxdWV1ZTxpbnQ+cTsKICAgIHEucHVzaChzcmMpOwogICAgd2hpbGUoIXEuZW1wdHkoKSl7CiAgICAgIGludCBzPXEuZnJvbnQoKTsKICAgICAgcS5wb3AoKTsKICAgIGZvcihpbnQgaT0wO2k8dltzXS5zaXplKCk7aSsrKXsKCiAgICAgICAgaWYodmlzW3Zbc11baV1dPT1ub3R2aXNpdGVkKQogICAgICAgIHsKICAgICAgICAgICAgaWYodmlzW3NdPT1ibGFjaykKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdmlzW3Zbc11baV1dPXdoaXRlOwogICAgICAgICAgICAgICAgdysrOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgaWYodmlzW3NdPT13aGl0ZSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdmlzW3Zbc11baV1dPWJsYWNrOwogICAgICAgICAgICAgICAgYisrOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHEucHVzaCh2W3NdW2ldKTsKICAgICAgICB9CiAgICAgIH0KICAgfQp9CmludCBtYWluKCkgewogICAgIGludCBuOwogICAgIHNjYW5mKCIlZCIsJm4pOwogICAgIGludCBtPW4tMSx4OwogICAgIHdoaWxlKG0tLSl7CiAgICAgICAgaW50IGEsYjsKICAgICAgICBzY2FuZigiJWQgJWQiLCZhLCZiKTsKICAgICAgICB2W2FdLnBiKGIpOwogICAgICAgIHZbYl0ucGIoYSk7CiAgICAgICAgeD1hOwogICAgIH0KICAgICBiZnMoeCk7CiAgICAgcHJpbnRmKCIlZFxuIixtaW4oYix3KSk7CglyZXR1cm4gMDsKfQo=