#include<iostream>

using namespace std;

int main(){
	int n,a,b,z;
	
	cin>>n;
	
	for(int i = 1; i<n;i++){
		cin>>a>>b;
		if (a<b){
			z+=a;
		}
		else{
			z+=b;
		}
	}
	
	if(2*z==n*(n-1)){
		cout<<n-2-(n+1)%2;
	}else{
		cout<<n-4-(n+1)%2+1;
	}
}