#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
char dir[] = {'R', 'L', 'D', 'U'};
const int MOD = 1e9 + 7;
const long long INF = 1e9;
void setIO(string filename) {
  if (fopen((filename + ".in").c_str(), "r")) {
    freopen((filename + ".in").c_str(), "r", stdin);
    freopen((filename + ".out").c_str(), "w", stdout);
  }
}
vector<vector<int>> adj;
int cntw = 0, cntb = 0;
void dfs(int par, int curr, int col) {
  if (col)
    cntw++;
  else
    cntb++;
  for (auto adjnode : adj[curr]) {
    if (adjnode == par) continue;
    dfs(curr, adjnode, !col);
  }
}
void solve() {
  int n;
  cin >> n;
  adj.resize(n);
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(-1, 0, 0);
  cout << min(cntw, cntb) - 1 << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t = 1;
  for (int i = 1; i <= t; i++) solve();
  return 0;
}
