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


int main()
{
    int n,x,y;
    cin>>n;
    for(int i=0; i<n-1; ++i) cin>>x>>y;
    if(n==1 || n==2) cout<<0;
    else if(n%2==0) cout<<n-3;
    else cout<<n-2;
}