#include <bits/stdc++.h>
const int MAX = 2000000;
const long long MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const long long LLINF = 0x3f3f3f3f3f3f3f3f;
const long double EPS = 1e-7;
const long double PI = acosl(-1.0);
using namespace std;
vector<vector<int> > grafo(200010, vector<int>());
int dfs(int u, int pai, bool cor) {
  int ans = cor;
  for (auto v : grafo[u]) {
    if (v == pai) continue;
    ans += dfs(v, u, !cor);
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, u, v;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    cin >> u >> v;
    grafo[u].push_back(v);
    grafo[v].push_back(u);
  }
  int ans = dfs(1, -1, 1);
  cout << min(ans, n - ans) - 1 << endl;
  return 0;
}
