#include <bits/stdc++.h>
using namespace std;
int coun[2];
vector<int> adj[200002];
void dfs(int x, int par, int now) {
  coun[now]++;
  for (auto it : adj[x]) {
    if (it != par) {
      dfs(it, x, now ^ 1);
    }
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(1, 0, 0);
  cout << min(coun[0], coun[1]) - 1 << endl;
}
