#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
const long long mxn = 3e5 + 7;
long long n;
vector<long long> g[mxn];
long long dep[mxn], par[mxn];
void dfs(long long u, long long p) {
  par[u] = p;
  for (long long v : g[u]) {
    if (v == p) continue;
    dep[v] = dep[u] + 1;
    dfs(v, u);
  }
}
long long vis[mxn], safe[mxn];
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 1; i < n; i++) {
    long long u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(1, 0);
  priority_queue<array<long long, 2> > q;
  for (long long i = 1; i <= n; i++) q.push({dep[i], i});
  long long ans = 0;
  while (!q.empty()) {
    long long d = q.top()[0], u = q.top()[1];
    q.pop();
    if (d > 2 && !vis[par[u]] && !safe[u]) {
      vis[par[u]] = 1;
      safe[u] = 1;
      safe[par[u]] = 1;
      safe[par[par[u]]] = 1;
      ans++;
    }
  }
  cout << ans;
  return 0;
}
