#include <bits/stdc++.h>
using namespace std;
vector<vector<long long>> ve;
vector<string> color;
vector<bool> used;
long long cw = 0, cb = 0;
void dfs(long long v) {
  used[v] = true;
  for (long long i = 0; i < ve[v].size(); i++) {
    if (used[ve[v][i]] == false) {
      if (color[v] == "b") {
        color[ve[v][i]] = "w";
        cw++;
      } else {
        color[ve[v][i]] = "b";
        cb++;
      }
      dfs(ve[v][i]);
    }
  }
}
signed main() {
  long long n;
  cin >> n;
  ve = vector<vector<long long>>(n);
  color = vector<string>(n);
  used = vector<bool>(n, false);
  for (long long i = 0; i < n - 1; i++) {
    long long x, y;
    cin >> x >> y;
    ve[x - 1].push_back(y - 1);
    ve[y - 1].push_back(x - 1);
  }
  color[0] = "b";
  cb++;
  dfs(0);
  long long ans = min(cw, cb) - 1;
  cout << ans << "\n";
  return 0;
}
