#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> adj(200010, vector<int>(0));
bool visited[200010];
int n;
int root;
long long white = 0;
void Join(int x, int y) {
  adj[x].push_back(y);
  adj[y].push_back(x);
}
void dfs() {
  stack<pair<int, int>> stk;
  stk.push(make_pair(root, 0));
  while (!stk.empty()) {
    int node = stk.top().first;
    int dist = stk.top().second;
    stk.pop();
    visited[node] = 1;
    if (dist % 2 == 0) white++;
    for (int i = 0; i < adj[node].size(); i++) {
      if (visited[adj[node][i]]) continue;
      stk.push(make_pair(adj[node][i], dist + 1));
    }
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    Join(x - 1, y - 1);
  }
  root = 0;
  dfs();
  cout << min(white, n - white) - 1 << endl;
  return 0;
}
