#include <bits/stdc++.h>
using namespace std;
int n, maxd;
vector<vector<int> > g;
vector<int> dist;
vector<int> p;
vector<int> v;
void dfs(int u, int pre, int d) {
  p[u] = pre;
  dist[u] = d;
  maxd = max(maxd, d);
  for (int i = 0; i < g[u].size(); ++i) {
    if (g[u][i] != pre) {
      dfs(g[u][i], u, d + 1);
    }
  }
  if (g[u].size() == 1 && d > 2) v[u] = 2;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  g = vector<vector<int> >(n);
  dist = vector<int>(n);
  p = vector<int>(n);
  v = vector<int>(n, 3);
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  maxd = 0;
  dfs(0, 0, 0);
  priority_queue<pair<int, int> > q;
  for (int i = 0; i < n; ++i) {
    if (v[i] == 2) {
      q.push(pair<int, int>(maxd, i));
    }
  }
  while (!q.empty() && q.top().first > 2) {
    int u = q.top().second;
    q.pop();
    if (v[p[u]] == 3) q.push(pair<int, int>(dist[p[u]], p[u]));
    v[p[u]] = min((v[u] + 1) % 3, v[p[u]]);
  }
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    ans += (v[i] == 0);
  }
  cout << ans << endl;
}
