#include <bits/stdc++.h>
using namespace std;
void adde(vector<long long int> adj[], long long int u, long long int v) {
  adj[u].push_back(v);
  adj[v].push_back(u);
}
void bfss(vector<long long int> adj[], long long int bfs[], long long int cur,
          long long int par, long long int lev) {
  bfs[cur] = lev;
  for (long long int i = 0; i < adj[cur].size(); i++) {
    if (adj[cur][i] != par) bfss(adj, bfs, adj[cur][i], cur, lev + 1);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n;
  cin >> n;
  vector<long long int> adj[n + 1];
  long long int u, v;
  for (long long int i = 0; i < n - 1; i++) {
    cin >> u >> v;
    adde(adj, u, v);
  }
  long long int bfs[n + 1];
  memset(bfs, -1, sizeof(bfs));
  bfss(adj, bfs, 1, 0, 0);
  long long int ne = 0, no = 0;
  for (long long int i = 1; i <= n; i++) {
    if (bfs[i] % 2 == 0)
      ne++;
    else
      no++;
  }
  cout << min(ne, no) - 1;
  return 0;
}
