#include <bits/stdc++.h>
using namespace std;
char _buf[100000], *_op(_buf), *_ed(_buf);
inline int getint() {
  int _s = 0;
  char _ch = (_op == _ed && (_ed = (_op = _buf) + fread(_buf, 1, 100000, stdin),
                             _op == _ed)
                  ? EOF
                  : *_op++);
  while (!('0' <= _ch && _ch <= '9'))
    _ch = (_op == _ed && (_ed = (_op = _buf) + fread(_buf, 1, 100000, stdin),
                          _op == _ed)
               ? EOF
               : *_op++);
  while (('0' <= _ch && _ch <= '9'))
    _s = _s * 10 + _ch - 48,
    _ch = (_op == _ed && (_ed = (_op = _buf) + fread(_buf, 1, 100000, stdin),
                          _op == _ed)
               ? EOF
               : *_op++);
  return _s;
}
const int N = 2e5 + 1, INF = 0x3f3f3f3f;
int n, ans;
vector<int> e[N];
inline void add_edge(int x, int y) { e[x].push_back(y), e[y].push_back(x); }
inline void input() {
  n = getint();
  for (int i = 2; i <= n; i++) add_edge(getint(), getint());
}
inline void dfs(int u, int fa = 0, int d = 0) {
  ans += d;
  for (int v : e[u])
    if (v ^ fa) dfs(v, u, d ^ 1);
}
inline void init() { dfs(1); }
inline void work() { cout << min(ans, n - ans) - 1; }
int main() {
  input();
  init();
  work();
  return 0;
}
