#include <bits/stdc++.h>
inline long long rd() {
  long long _x = 0;
  int _ch = getchar(), _f = 1;
  for (; !isdigit(_ch) && (_ch != '-') && (_ch != EOF); _ch = getchar())
    ;
  if (_ch == '-') {
    _f = 0;
    _ch = getchar();
  }
  for (; isdigit(_ch); _ch = getchar()) _x = _x * 10 + _ch - '0';
  return _f ? _x : -_x;
}
void write(long long _x) {
  if (_x >= 10)
    write(_x / 10), putchar(_x % 10 + '0');
  else
    putchar(_x + '0');
}
inline void wrt(long long _x, char _p) {
  if (_x < 0) putchar('-'), _x = -_x;
  write(_x);
  if (_p) putchar(_p);
}
int n;
std::vector<int> G[200005];
int cnt[2];
void dfs(int u, int c, int fa) {
  cnt[c]++;
  for (auto i : G[u])
    if (i != fa) {
      dfs(i, c ^ 1, u);
    }
}
int main() {
  n = rd();
  for (int i = 1; i <= n; i++) {
    int x = rd(), y = rd();
    G[x].push_back(y), G[y].push_back(x);
  }
  dfs(1, 0, 0);
  wrt(std::min(cnt[0], cnt[1]) - 1, '\n');
}
