#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void prn(Arg1&& arg1) {
  cout << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void prn(Arg1&& arg1, Args&&... args) {
  cout << arg1 << " ";
  prn(args...);
}
template <typename Arg1>
void read(Arg1&& arg1) {
  cin >> arg1;
}
template <typename Arg1, typename... Args>
void read(Arg1&& arg1, Args&&... args) {
  cin >> arg1;
  read(args...);
}
const long long inf = 1e18;
const int N = 2e5 + 1;
int n;
vector<int> adj[N];
int num[2];
long long tans;
void dfs(int cur, int d, int p) {
  ++num[d];
  d ^= 1;
  for (auto i : adj[cur]) {
    if (i != p) {
      dfs(i, d, cur);
    }
  }
}
void solve() {
  read(n);
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    read(a, b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  dfs(1, 0, 0);
  prn(min(num[0], num[1]) - 1);
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) solve();
  return 0;
}
