#include <bits/stdc++.h>
using namespace std;
vector<vector<long>> adj;
vector<bool> visited;
long b = 0, w = 0;
void dfs(long node, bool black) {
  if (!visited[node]) {
    visited[node] = true;
    if (black)
      b++;
    else
      w++;
    for (long i = 0; i < adj[node].size(); i++) {
      dfs(adj[node][i], !black);
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long n;
  cin >> n;
  adj.resize(n + 1);
  visited.resize(n + 1, false);
  for (long i = 1; i < n; i++) {
    long x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  dfs(1, true);
  cout << min(b, w) - 1 << "\n";
  return 0;
}
