#include <iostream>
using namespace std;

int main(int argc, char** argv) {
	int n,i;
	cin >> n;
	int a[2*(n-1)];
	for(i = 0;i<2*n - 2;i=i+2){
		cin>>a[i]>>a[i+1];
	}
	if(n%2==0) cout << n-3 << endl;
	else cout << n-2 << endl; 
	return 0;
}