#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>
inline T range(T l, T r) {
  return uniform_int_distribution<T>(l, r)(rng);
}
inline void setin(string s) { freopen(s.c_str(), "r", stdin); }
inline void setout(string s) { freopen(s.c_str(), "w", stdout); }
template <typename T>
void Min(T &a, T b) {
  a = min(a, b);
}
template <typename T>
void Max(T &a, T b) {
  a = max(a, b);
}
const int mod = 998244353;
const int inf = 0x3f3f3f3f;
const int N = 1e6 + 15;
int n;
vector<int> g[N];
int cnt[N], cl[N];
void dfs(int v, int p = -1) {
  cnt[cl[v]]++;
  for (int to : g[v]) {
    if (to != p) {
      cl[to] = cl[v] ^ 1;
      dfs(to, v);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(1);
  cout << min(cnt[0], cnt[1]) - 1 << '\n';
  return 0;
}
