#include <bits/stdc++.h>
using namespace std;
void input() {
  freopen("in.txt", "r", stdin);
  freopen("out.txt", "w", stdout);
}
const int N = 1e6 + 10;
vector<int> G[N];
int in[N], n, cnt[3], vis[N];
void dfs(int x, int flag) {
  cnt[flag]++;
  vis[x] = 1;
  for (int i = 0; i < G[x].size(); i++) {
    int u = G[x][i];
    if (vis[u]) continue;
    dfs(u, (flag + 1) % 2);
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n - 1; i++) {
    int u, v;
    cin >> u >> v;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  dfs(1, 1);
  cout << min(cnt[0], cnt[1]) - 1 << '\n';
  return 0;
}
