#include <bits/stdc++.h>
using namespace std;
const int mx = 2e5 + 10;
vector<int> adj[mx];
int dis[mx];
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);
  }
  queue<int> q;
  int even = 0, odd = 1;
  q.push(1);
  dis[1] = 1;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = 0; i < adj[u].size(); i++) {
      int v = adj[u][i];
      if (!dis[v]) {
        q.push(v);
        dis[v] = dis[u] + 1;
        if (dis[v] % 2 == 0)
          even++;
        else
          odd++;
      }
    }
  }
  cout << min(even, odd) - 1 << endl;
  return 0;
}
