#include <bits/stdc++.h>
using namespace std;
vector<long long int> adj[200005];
vector<vector<long long int> > dp(200005, vector<long long int>(2, 0));
long long int ans = 1e18;
void dfs(long long int x, long long int pre) {
  for (auto y : adj[x]) {
    if (y == pre) continue;
    dfs(y, x);
    dp[x][0] += dp[y][1] + ((long long int)(adj[y]).size()) - 1;
    dp[x][1] += dp[y][0];
  }
}
void down(long long int x, long long int pre, long long int a,
          long long int b) {
  for (auto y : adj[x]) {
    if (y == pre) continue;
    down(y, x,
         b + (dp[x][0] - (dp[y][1] + ((long long int)(adj[y]).size()) - 1)) +
             ((long long int)(adj[pre]).size()) - 1,
         a + dp[x][1] - dp[y][0]);
  }
  if (pre) {
    ans = min(ans, dp[x][0] + b + ((long long int)(adj[pre]).size()) - 1);
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n;
  cin >> n;
  adj[0].push_back(1212);
  for (long long int i = 0; i < n - 1; i++) {
    long long int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  long long int root = 1;
  dfs(root, 0);
  ans = dp[root][0];
  down(root, 0, 0, 0);
  cout << ans;
}
