#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 998244353;
template <typename TTF, typename TTS>
void dfs(TTF p, TTF v, TTS d, vector<vector<TTF>>& clis, vector<TTF>& parlis,
         vector<TTS>& dislis) {
  dislis[v] = d;
  parlis[v] = p;
  for (auto it = begin(clis[v]); it != end(clis[v]); ++it) {
    if (dislis[*it] <= dislis[v] + 1) continue;
    dfs(v, *it, d + 1, clis, parlis, dislis);
  }
}
int main() {
  int n = 0;
  cin >> n;
  vector<vector<int>> lis(n, vector<int>(0));
  vector<int> dlis(n, INT_MAX);
  dlis[0] = 0;
  vector<int> plis(n, 0);
  for (ll(i) = (0); (i) < (n - 1); (i)++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    lis[a].push_back(b);
    lis[b].push_back(a);
  }
  dfs(0, 0, 0, lis, plis, dlis);
  int o = 0;
  int e = 0;
  for (ll(i) = (0); (i) < (n); (i)++) {
    if (dlis[i] % 2 == 0) {
      e++;
    } else {
      o++;
    }
  }
  cout << min(e, o) - 1 << endl;
}
