#include <bits/stdc++.h>
const long long maxn = 1e6;
using namespace std;
vector<vector<int> > adj;
int ans = 0, black = 0, white = 0;
bool vis[200001];
void dfs(int cur, int col) {
  if (!vis[cur]) {
    vis[cur] = true;
  }
  if (col)
    black++;
  else
    white++;
  for (int i = 0; i < adj[cur].size(); i++) {
    if (!vis[adj[cur][i]] and adj[adj[cur][i]].size() >= 2) {
      dfs(adj[cur][i], (col == 0 ? 1 : 0));
    } else if (!vis[adj[cur][i]] and adj[adj[cur][i]].size() == 1) {
      vis[adj[cur][i]] = true;
      if (col)
        white++;
      else
        black++;
    }
  }
}
int main() {
  int n, x, y;
  cin >> n;
  adj.resize(n + 1);
  for (int i = 0; i < n - 1; i++) {
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  memset(vis, false, sizeof(vis));
  dfs(1, 0);
  cout << min(black, white) - 1;
}
