#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> adj[200005];
int dfs(int cur, int prv, bool valid) {
  int cnt = valid;
  for (int nxt : adj[cur])
    if (nxt != prv) cnt += dfs(nxt, cur, !valid);
  return cnt;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> N;
  for (int i = 0, a, b; i < N - 1; i++) {
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  int cnt = dfs(1, 0, true);
  cout << min(cnt, N - cnt) - 1 << "\n";
  return 0;
}
