#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T read(T &f) {
  f = 0;
  int x = 1;
  char c = getchar();
  while (!isdigit(c)) x = c == '-' ? -1 : 1, c = getchar();
  while (isdigit(c)) (f *= 10) += c & 15, c = getchar();
  return f *= x;
}
template <typename T>
inline int chkmin(T &x, const T &y) {
  return x > y ? x = y, 1 : 0;
}
template <typename T>
inline int chkmax(T &x, const T &y) {
  return x <= y ? x = y, 1 : 0;
}
const int N = 200000 + 5;
int n, u, v;
struct Edge {
  int to;
  Edge *nxt;
} E[N << 1], *pre[N];
void addedge(int u, int v) {
  static int tot = 0;
  E[++tot] = (Edge){v, pre[u]}, pre[u] = &E[tot];
  E[++tot] = (Edge){u, pre[v]}, pre[v] = &E[tot];
}
const int INF = 0x3f3f3f3f;
int dep[N];
long long f[N][3];
void dfs(int x, int fa) {
  dep[x] = dep[fa] + 1;
  for (Edge *i = pre[x]; i; i = i->nxt) {
    v = i->to;
    if (fa == i->to) continue;
    dfs(v, x);
  }
  if (dep[x] > 2) {
    f[x][1] = 1, f[x][2] = INF;
    register int v;
    for (Edge *i = pre[x]; i; i = i->nxt) {
      v = i->to;
      if (fa == v) continue;
      f[x][1] += min(f[v][1], min(f[v][0], f[v][2]));
      f[x][2] += min(f[v][1], f[v][2]);
      f[x][2] = min(f[x][2], f[x][0] + f[v][1]);
      f[x][0] += f[v][2];
    }
  } else if (dep[x] == 2) {
    register int v;
    for (Edge *i = pre[x]; i; i = i->nxt) {
      v = i->to;
      if (v == fa) continue;
      f[x][0] += min(f[v][0], min(f[v][1], f[v][2]));
    }
  } else {
    for (Edge *i = pre[x]; i; i = i->nxt) {
      v = i->to;
      if (v == fa) continue;
      f[x][0] += f[v][0];
    }
  }
}
int Ans;
int main() {
  read(n);
  for (int i = (1), ___ = (n - 1); i <= ___; ++i) {
    read(u), read(v);
    addedge(u, v);
  }
  dfs(1, 0);
  cout << f[1][0] << endl;
  return 0;
}
