#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> edges[(200 * 1000 + 5)];
vector<int> f;
vector<int> a;
int dp[(200 * 1000 + 5)][5];
void read_data() {
  cin >> n;
  int u, v;
  for (int i = 1; i < n; i++) {
    scanf("%d %d", &u, &v);
    edges[u].push_back(v);
    edges[v].push_back(u);
  }
}
void bfs() {
  int qf, ql;
  a.resize(n);
  f.resize(n + 1);
  vector<int> isv;
  isv.resize(n + 1);
  qf = ql = 0;
  a[ql++] = 1;
  isv[1] = true;
  while (qf != ql) {
    int u = a[qf++];
    for (auto &v : edges[u])
      if (!isv[v]) {
        f[v] = u;
        isv[v] = true;
        a[ql++] = v;
      }
  }
}
void deal() {
  int sum[5];
  for (int i = n - 1; i > 0; i--) {
    int u = a[i];
    if (edges[u].size() == 1 && u != 1) {
      memset(dp[u], 0, sizeof(dp[u]));
      dp[u][0] = 1;
      dp[u][1] = 0;
      dp[u][2] = 1;
    } else {
      memset(sum, 0, sizeof(sum));
      for (auto &v : edges[u])
        if (v != f[u]) {
          sum[2] += dp[v][2];
          sum[1] += dp[v][1];
        }
      memset(dp[u], 0xff, sizeof(dp[u]));
      dp[u][1] = sum[2];
      dp[u][0] = sum[1] + 1;
      for (auto &v : edges[u])
        if (v != f[u]) {
          if (dp[u][2] == -1) {
            dp[u][2] = sum[2] - dp[v][2] + dp[v][0];
          } else {
            dp[u][2] = min(dp[u][2], sum[2] - dp[v][2] + dp[v][0]);
          }
        }
      dp[u][2] = min(dp[u][2], dp[u][0]);
      dp[u][1] = min(dp[u][1], dp[u][2]);
    }
  }
  int ans = 0;
  for (auto &v : edges[1]) ans += dp[v][0];
  ans -= edges[1].size();
  cout << ans << endl;
}
int main() {
  read_data();
  bfs();
  deal();
  return 0;
}
