#include int u[200005], v[200005]; int h[200005], l; int comp_h(int a, int b) { if (u[h[a]] > u[h[b]]) return 1; else return -1; } void swap_h(int a, int b) { int f = h[a]; h[a] = h[b]; h[b] = f; return; } void push(int ne) { h[l] = ne; int p = l; l++; for (; p > 0; p = (p - 1) / 2) if (comp_h((p - 1) / 2, p) > 0) swap_h((p - 1) / 2, p); return; } int pop() { l--; swap_h(0, l); int p = 0; for (;;) { if (2 * p + 2 < l) { if (comp_h(2 * p + 1, 2 * p + 2) > 0) { if (comp_h(p, 2 * p + 2) > 0) swap_h(p, 2 * p + 2); p = 2 * p + 2; } else { if (comp_h(p, 2 * p + 1) > 0) swap_h(p, 2 * p + 1); p = 2 * p + 1; } } else if (2 * p + 1 < l) { if (comp_h(p, 2 * p + 1) > 0) swap_h(p, 2 * p + 1); p = 2 * p + 1; } else break; } return h[l]; } int main() { int n; scanf("%d", &n); int i; for (i = 0; i < n - 1; i++) { i *= 2; scanf("%d %d", &u[i], &v[i]); u[i]--; v[i]--; u[i + 1] = v[i]; v[i + 1] = u[i]; i /= 2; } l = 0; for (i = 0; i < 2 * n - 2; i++) push(i); int c[200005]; for (i = 0; i < 2 * n - 2; i++) c[i] = pop(); int depth[100005]; for (i = 0; i < n; i++) depth[i] = -1; int stack[100005]; l = 0; depth[0] = 0; stack[0] = 0; l++; int min, mid, max; c[2 * n - 2] = 2 * n - 2; u[2 * n - 2] = -1; while (l > 0) { l--; i = stack[l]; min = -1; max = 2 * n - 2; while (max - min > 1) { mid = (max + min) / 2; if (u[c[mid]] < i) min = mid; else max = mid; } for (; u[c[max]] == i; max++) { if (depth[v[c[max]]] < 0) { depth[v[c[max]]] = depth[i] + 1; stack[l] = v[c[max]]; l++; } } } int cnt[2]; cnt[0] = cnt[1] = 0; for (i = 0; i < n; i++) cnt[depth[i] % 2]++; if (cnt[0] < cnt[1]) printf("%d\n", cnt[0]); else printf("%d\n", cnt[1]); return 0; }