#include <bits/stdc++.h>
using namespace std;
vector<long long> g[200010];
long long ar[2] = {0};
void dfs(long long p, long long f, long long st) {
  ar[st]++;
  for (long long u : g[p]) {
    if (u == f) continue;
    dfs(u, p, 1 ^ st);
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  for (long long i = 0; i < n - 1; i++) {
    long long a, b;
    cin >> a >> b;
    --a, --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  dfs(0, -1, 0);
  cout << min(ar[0], ar[1]) - 1 << '\n';
  return 0;
}
