#include <bits/stdc++.h>
using namespace std;
int bfs(vector<int> graph[], int root, int n) {
  vector<bool> vis(n + 1, false);
  queue<int> q;
  vector<int> dist(n + 1, INT_MAX);
  dist[root] = 0;
  q.push(root);
  vis[root] = true;
  vector<int> color(n + 1, 0);
  color[root] = 0;
  while (!q.empty()) {
    int t = q.front();
    q.pop();
    for (auto m : graph[t]) {
      if (!vis[m]) {
        vis[m] = true;
        q.push(m);
        dist[m] = dist[t] + 1;
        color[m] = color[t] ^ 1;
      }
    }
  }
  int cnt = 0;
  for (int i = 1; i < n + 1; i++)
    if (color[i]) cnt++;
  return min(cnt, n - cnt);
}
int main() {
  long long t = 1;
  while (t--) {
    int n;
    cin >> n;
    vector<int> graph[n + 1];
    vector<int> deg(n + 1, 0);
    for (int i = 0; i < n - 1; i++) {
      int a, b;
      cin >> a >> b;
      graph[a].push_back(b);
      graph[b].push_back(a);
      deg[a]++, deg[b]++;
    }
    int root = 1;
    int maxi = bfs(graph, root, n);
    cout << maxi - 1 << "\n";
  }
  return 0;
}
