#include <bits/stdc++.h>
using namespace std;
vector<int> adj[200005];
int w = 0, b = 0;
void dfs(int u, int p, int c) {
  if (c == 0)
    w++;
  else
    b++;
  for (int v : adj[u]) {
    if (v != p) dfs(v, u, 1 - c);
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(1, 0, 0);
  cout << min(w, b) - 1 << endl;
  return 0;
}
