#include <bits/stdc++.h>
using namespace std;
int n, d[200100], idx;
vector<int> E[200100];
int ans;
void DFS(int id, int pre, int h) {
  int nxt;
  d[id] = h;
  for (int i = 0; i < E[id].size(); i++) {
    nxt = E[id][i];
    if (nxt == pre) continue;
    DFS(nxt, id, h + 1);
  }
}
int main() {
  int u, v;
  cin >> n;
  for (int i = 0; i < n; i++) {
    E[i].clear();
  }
  for (int i = 1; i < n; i++) {
    cin >> u >> v;
    u--;
    v--;
    E[u].push_back(v);
    E[v].push_back(u);
  }
  DFS(0, -1, 0);
  int a, b;
  a = b = 0;
  for (int i = 0; i < n; i++) {
    if (d[i] & 1)
      a++;
    else
      b++;
  }
  ans = min(a, b) - 1;
  cout << ans << endl;
  return 0;
}
