#include <bits/stdc++.h>

#define pb push_back
#define MAXN 100010

using namespace std;

vector<int> graph[MAXN];

int main() {

    int n;
    cin >> n;
    for(int i = 0; i < n - 1; i++) {
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        graph[u].pb(v);
        graph[v].pb(u);
    }

    if(n & 1)
        cout << n - 2 << endl;
    else
        cout << n - 3 << endl;
    return 0;
}