#include <bits/stdc++.h>
using namespace std;
vector<int> x[200000];
int n, b = 0, w = 0;
void idi(int i, int p, int bw) {
  if (bw)
    w++;
  else
    b++;
  for (int j = 0; j < x[i].size(); j++)
    if (x[i][j] != p) idi(x[i][j], i, 1 - bw);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    x[a].push_back(b);
    x[b].push_back(a);
  }
  idi(0, -1, 1);
  cout << min(b, w) - 1;
  return 0;
}
