#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 1;
vector<int> ok[N];
int vis[N], par[N], choosed[N];
set<pair<int, int> > go;
set<pair<int, int> >::iterator it;
void dfs(int p, int node, int path) {
  vis[node] = path;
  par[node] = p;
  for (int i = 0; i < ok[node].size(); i++) {
    int u = ok[node][i];
    if (vis[u] == -1) dfs(node, u, path + 1);
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0, u, v; i < n; i++) {
    scanf("%d%d", &u, &v);
    ok[u].push_back(v);
    ok[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) vis[i] = -1;
  dfs(0, 1, 0);
  for (int i = 1; i <= n; i++)
    if (vis[i] > 2) go.insert(make_pair(-vis[i], i));
  int ans = 0;
  for (it = go.begin(); it != go.end(); it++) {
    if (choosed[it->second]) continue;
    choosed[it->second] = 1;
    ans++;
    int pr = par[it->second];
    choosed[pr] = 1;
    for (int i = 0; i < ok[pr].size(); i++) choosed[ok[pr][i]] = 1;
  }
  printf("%d", ans);
  return 0;
}
