#include
using namespace std;
struct edge { int t; edge *next; };
const int maxn = 109; const int inf = 0x3f3f3f3f;
edge *head[maxn], ebuf_arr[maxn « 1], ebuf; int n, f[maxn][2][2]; / f[node][if u is light][if u is chosen] */
inline void addEdge(int u, int v) { ebuf-> t = v; ebuf-> next = head[u]; head[u] = ebuf ++; }
#define protect(x) {
if (x > inf)
x = inf;
}
void dfsDP(int p, int fr) { int g[2][2][2], cur(0), prv(1); g[cur][0][0] = 0; g[cur][1][1] = 1; g[cur][0][1] = g[cur][1][0] = inf; for (edge* e = head[p]; e; e = e-> next) if (e-> t != fr) { dfsDP(e-> t, p); swap(cur, prv); g[cur][0][0] = min(g[prv][0][0] + f[e-> t][1][0], g[prv][1][0] + f[e-> t][1][1]); g[cur][1][0] = min(g[prv][1][0] + f[e-> t][1][0], g[prv][0][0] + f[e-> t][1][1]); protect(g[cur][0][0]); protect(g[cur][1][0]); g[cur][0][1] = min(g[prv][0][1] + f[e-> t][0][0], g[prv][1][1] + f[e-> t][0][1]); g[cur][1][1] = min(g[prv][1][1] + f[e-> t][0][0], g[prv][0][1] + f[e-> t][0][1]); protect(g[cur][0][1]); protect(g[cur][1][1]); } f[p][0][0] = g[cur][0][0]; f[p][1][0] = g[cur][1][0]; f[p][0][1] = g[cur][0][1]; f[p][1][1] = g[cur][1][1]; }
int main() { #ifndef ONLINE_JUDGE freopen(".in", “r”, stdin); #endif
while (scanf("%d", &n), n) {
memset(head, 0, sizeof(head));
ebuf = ebuf_arr;
for (int i = 1; i < n; ++ i) {
int u, v;
scanf("%d%d", &u, &v);
addEdge(u, v);
addEdge(v, u);
}
dfsDP(1, 0);
printf("%d\n", min(f[1][1][0], f[1][1][1]));
}
}