#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > adj;
vector<int> color;
int white = 0, red = 0;
void dfs(int node, int now) {
  color[node] = now;
  for (auto child : adj[node]) {
    if (color[child] != -1) continue;
    dfs(child, !now);
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  adj.resize(n);
  color.assign(n, -1);
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    adj[u].emplace_back(v);
    adj[v].emplace_back(u);
  }
  dfs(0, 0);
  for (int i : color) {
    if (i == 0)
      red++;
    else
      white++;
  }
  cout << min(white, red) - 1 << "\n";
  return 0;
}
