#include <bits/stdc++.h>
using namespace std;
long long head[200010], cnt;
class littlestar {
 public:
  long long to, nxt;
  void add(long long u, long long v) {
    to = v;
    nxt = head[u];
    head[u] = cnt;
  }
} star[400010];
long long n, f[200010], g[200010], h[200010];
void dfs(long long u, long long fa) {
  for (long long i = head[u]; i; i = star[i].nxt) {
    long long v = star[i].to;
    if (v == fa) continue;
    dfs(v, u);
    f[fa] = f[fa] + f[v] + 1;
    g[u] = g[u] + f[v] + 1;
  }
}
void dp(long long u, long long fa) {
  for (long long i = head[u]; i; i = star[i].nxt) {
    long long v = star[i].to;
    if (v == fa) continue;
    h[v] = g[u] - 1;
    if (fa) h[v] = h[fa];
    dp(v, u);
  }
}
signed main() {
  cin >> n;
  for (register long long i = 1; i <= n - 1; i++) {
    long long x, y;
    scanf("%lld%lld", &x, &y);
    star[++cnt].add(x, y);
    star[++cnt].add(y, x);
  }
  dfs(1, 0);
  h[1] = f[1];
  dp(1, 0);
  long long ans = LLONG_MAX;
  for (register long long i = 1; i <= n; i++) ans = min(ans, h[i]);
  cout << ans;
}
