#include<bits/stdc++.h>
using namespace std;

int a,b,N;
int main()
{
    cin>>N;

    for(int i=1; i<N; i++)cin>>a>>b;

    if(N==2)cout<<0<<endl;
    if(N==3 or N==4)cout<<1<<endl;
    if(N%2==1 and N>=5)cout<<N-2<<endl;
    if(N%2==0 and N>=5)cout<<N-3<<endl;

    return 0;
}