#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
int n, u, v, od, ev;
vector<int> edge[N];
void dfs(int u, int par, int col) {
  if (col == 0)
    ev++;
  else
    od++;
  for (int v : edge[u]) {
    if (v == par) continue;
    dfs(v, u, col ^ 1);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i < n; i++) {
    cin >> u >> v;
    edge[u].push_back(v);
    edge[v].push_back(u);
  }
  dfs(1, 1, 0);
  cout << min(od, ev) - 1;
}
