#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int ch = getchar(), f = 0;
  int x = 0;
  while (ch < '0' || ch > '9') {
    f |= ch == '-';
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return f ? -x : x;
}
struct eric {
  int to, next;
} edge[400005 << 1];
int head[400005], size;
int n, m, ans;
int f[400005][3], deep[400005];
inline void add(int x, int y) {
  edge[++size].to = y;
  edge[size].next = head[x];
  head[x] = size;
}
inline void dfs(int pos, int fa) {
  deep[pos] = deep[fa] + 1;
  int minx = 1000000007;
  for (int i = head[pos]; i; i = edge[i].next) {
    int v = edge[i].to;
    if (v == fa) continue;
    dfs(v, pos);
    f[pos][2] += min(f[v][0], f[v][1]);
    minx = min(minx, f[v][1] - f[v][0]);
    f[pos][1] += min(f[v][2], min(f[v][2], f[v][1]));
  }
  if (minx > 0)
    f[pos][0] = f[pos][2] + minx;
  else
    f[pos][0] = f[pos][2];
  f[pos][1]++;
  if (deep[pos] == 3) ans += min(f[pos][2], f[pos][1]);
}
int main() {
  n = read();
  int x, y;
  for (int i = 1; i < n; i++) {
    x = read(), y = read();
    add(x, y);
    add(y, x);
  }
  dfs(1, 0);
  printf("%d\n", ans);
}
