#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int n;
vector<int> ad[N];
int cnt[2];
void dfs(int u, int par, int cl) {
  cnt[cl]++;
  for (auto &v : ad[u]) {
    if (v != par) {
      dfs(v, u, cl ^ 1);
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 2, _c = n; i <= _c; ++i) {
    int u, v;
    cin >> u >> v;
    ad[u].push_back(v);
    ad[v].push_back(u);
  }
  dfs(1, -1, 0);
  cout << min(cnt[0], cnt[1]) - 1;
}
