#include <bits/stdc++.h>
using namespace std;
const int N = 2 * 100 * 1000 + 20;
vector<int> adj[N];
int cnt[2];
void DFS(int v, int par = -1, int d = 0) {
  cnt[d & 1]++;
  for (auto u : adj[v])
    if (u ^ par) DFS(u, v, d ^ 1);
}
int main() {
  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int n;
  cin >> n;
  for (int i = 1, v, u; i < n; i++) {
    cin >> v >> u;
    adj[--v].push_back(--u);
    adj[u].push_back(v);
  }
  DFS(0);
  cout << min(cnt[0], cnt[1]) - 1 << endl;
  return 0;
}
