#include <bits/stdc++.h>
using namespace std;
vector<vector<long long int> > graph;
map<pair<long long int, long long int>, long long int> memo;
long long int dp(long long int cur_vertex, long long int parent,
                 long long int root_penalty) {
  if (memo.find(make_pair(cur_vertex, root_penalty)) != memo.end()) {
    return memo[make_pair(cur_vertex, root_penalty)];
  }
  if (root_penalty <= 2) {
    long long int ans = 0;
    for (auto v : graph[cur_vertex]) {
      if (v != parent) {
        ans += dp(v, cur_vertex, root_penalty + 1);
      }
    }
    long long int ans1 = 1;
    for (auto v : graph[cur_vertex]) {
      if (v != parent) {
        ans1 += dp(v, cur_vertex, 2);
      }
    }
    ans = min(ans, ans1);
    memo[make_pair(cur_vertex, root_penalty)] = ans;
    return ans;
  } else {
    long long int ans1 = 1;
    for (auto v : graph[cur_vertex]) {
      if (v != parent) {
        ans1 += dp(v, cur_vertex, 2);
      }
    }
    long long int ans2 = 0;
    for (auto v : graph[cur_vertex]) {
      if (v != parent) {
        ans2 += dp(v, cur_vertex, 3);
      }
    }
    long long int min_ans2 = INT_MAX;
    for (auto v : graph[cur_vertex]) {
      if (v != parent) {
        long long int newans =
            ans2 + 1 - dp(v, cur_vertex, 3) + dp(v, cur_vertex, 1);
        if (newans < min_ans2) {
          min_ans2 = newans;
        }
      }
    }
    memo[make_pair(cur_vertex, root_penalty)] = min(min_ans2, ans1);
    return memo[make_pair(cur_vertex, root_penalty)];
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n;
  cin >> n;
  graph.resize(n);
  for (long long int i = 0; i < n - 1; i++) {
    long long int u, v;
    cin >> u >> v;
    graph[u - 1].push_back(v - 1);
    graph[v - 1].push_back(u - 1);
  }
  long long int ans = dp(0, -1, 0);
  cout << ans << endl;
  return 0;
}
