#include <bits/stdc++.h>
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
using namespace std;
const long long N = 5e5 + 5;
const long long mod = 998244353;
const long long INF = 1e18;
const int INFi = 0x7f7f7f7f;
long long test = 1, n, ans[2], depth[N];
vector<long long> adj[N];
void dfs(int x, int p) {
  depth[x] = depth[p] + 1;
  ans[depth[x] % 2]++;
  for (auto it : adj[x]) {
    if (it == p) continue;
    dfs(it, x);
  }
}
void solve() {
  cin >> n;
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(1, 0);
  cout << min(ans[0], ans[1]) - 1 << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed;
  cout << setprecision(10);
  ;
  for (int i = 1; i <= test; i++) {
    solve();
  }
}
