#include <bits/stdc++.h>
using namespace std;
const int maxi = 1e6 + 2;
vector<int> v[maxi];
int lev[maxi];
int ans;
int ugradjen[maxi];
int dete[maxi];
void dfs(int x, int pred) {
  lev[x] = lev[pred] + 1;
  for (int i : v[x])
    if (i != pred) dfs(i, x);
  return;
}
void dfs1(int x, int pred) {
  int ugdete = 0;
  int ugunuk = 0;
  int total = 0;
  for (int i : v[x])
    if (i != pred) {
      dfs1(i, x);
      total++;
      if (ugradjen[i])
        ugdete++;
      else if (dete[i])
        ugunuk++;
    }
  if (total != ugdete + ugunuk) {
    if (lev[x] > 2) ans++;
    ugradjen[x] = 1;
  } else if (ugdete)
    dete[x] = 1;
  return;
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    v[x].push_back(y);
    v[y].push_back(x);
  }
  dfs(1, 0);
  dfs1(1, 0);
  cout << ans << endl;
  return 0;
}
