#include <bits/stdc++.h>
using namespace std;
int cnt[2];
vector<int> a[200010];
void dfs(int u, int pr, int cl) {
  ++cnt[cl];
  for (auto v : a[u])
    if (v != pr) dfs(v, u, cl ^ 1);
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n - 1; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    a[u].push_back(v);
    a[v].push_back(u);
  }
  dfs(1, -1, 0);
  cout << min(cnt[0], cnt[1]) - 1;
}
