#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const int inf = 1e9;
int n;
vector<int> g[200010];
int d[200010];
void dfs(int x, int p) {
  for (auto i : g[x]) {
    if (i == p) continue;
    d[i] = d[x] + 1;
    dfs(i, x);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    g[u].emplace_back(v);
    g[v].emplace_back(u);
  }
  dfs(1, 0);
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (d[i] % 2 == 0) cnt++;
  }
  cout << min(cnt, n - cnt) - 1 << "\n";
}
