#include <bits/stdc++.h>
using namespace std;
template <class t>
inline t read(t &x) {
  bool f = 0;
  char c = getchar();
  x = 0;
  while (!isdigit(c)) f |= c == '-', c = getchar();
  while (isdigit(c)) x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
  if (f) x = -x;
  return x;
}
template <class t>
inline void write(t x) {
  if (x < 0)
    putchar('-'), write(-x);
  else {
    if (x > 9) write(x / 10);
    putchar('0' + x % 10);
  }
}
const int N = 2e5 + 5;
int n, cnt[2];
vector<int> g[N];
void dfs(int x, int fa, int d) {
  cnt[d]++;
  for (int y : g[x])
    if (y ^ fa) dfs(y, x, d ^ 1);
}
signed main() {
  read(n);
  for (int i = 1, x, y; i < n; i++) {
    read(x);
    read(y);
    g[x].push_back(y);
    g[y].push_back(x);
  }
  dfs(1, 0, 0);
  write(min(cnt[0], cnt[1]) - 1);
}
