#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> g;
vector<array<array<int, 2>, 2>> dp;
void dfs(int v, int p) {
  for (int u : g[v])
    if (u != p) {
      dfs(u, v);
      dp[v][1][0] += min(dp[u][0][1], 1 + dp[u][1][1]);
      dp[v][1][1] += min(dp[u][0][1], 1 + dp[u][1][1]);
      dp[v][0][1] += min(dp[u][0][0], 1 + dp[u][1][0]);
    }
  dp[v][0][0] = INT_MAX;
  for (int u : g[v])
    if (u != p) {
      dp[v][0][0] =
          min(dp[v][0][0], dp[v][0][1] - min(dp[u][0][0], 1 + dp[u][1][0]) + 1 +
                               dp[u][1][0]);
    }
}
void solve_test() {
  int n;
  cin >> n;
  g.resize(n);
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  int cost = 0;
  dp.resize(n);
  for (int u : g[0]) {
    dfs(u, 0);
    cost += dp[u][1][1];
  }
  cout << cost << '\n';
}
int main() {
  int T;
  T = 1;
  while (T--) solve_test();
  return 0;
}
