#include <bits/stdc++.h>
using namespace std;
long long int n, d[200007], w, b;
vector<long long int> adj[200007];
void dfs(long long int x, long long int p) {
  if (d[x] % 2)
    w++;
  else
    b++;
  for (long long int i : adj[x]) {
    if (i == p) continue;
    d[i] = d[x] + 1;
    dfs(i, x);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (long long int i = 0; i < n - 1; ++i) {
    long long int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  dfs(1, 0);
  cout << min(w, b) - 1 << '\n';
  return 0;
}
