#include<iostream> #include<cstdio> #include<cstring> #include<bitset> #define MAX_N 100 usingnamespace std; int n, x[MAX_N+5], num[MAX_N+5], cnt; bitset <MAX_N+5> f[MAX_N+5]; voidinit(){cnt = 0; for (int i = 1; i <= n; i++) f[i].reset(), f[i][i] = f[i][n+1] = 1;} voidgauss(){ int cur = 1; for (int i = 1, tmp; i <= n; i++) { for (tmp = cur; tmp <= n; tmp++) if (f[tmp][i] == 1) break; if (tmp > n) {num[cnt++] = i; continue;} swap(f[cur], f[tmp]); for (int j = 1; j <= n; j++) if (j != cur && f[j][i]) f[j] ^= f[cur]; cur++; } } intcalc(int sta){ int ret = 0; for (int i = 1; i <= n; i++) x[i] = f[i][n+1]; for (int i = 0; i < cnt; i++) { if (!(sta&(1<<i))) continue; ret++; for (int j = 1; j <= n; j++) if (f[j][num[i]]) x[j] ^= 1; } for (int i = 1; i <= n; i++) ret += x[i]; return ret; } intmain(){ while (scanf("%d", &n) && n != 0) { init(); for (int i = 1, u, v; i < n; i++) scanf("%d%d", &u, &v), f[u][v] = f[v][u] = 1; gauss(); int ans = n; for (int sta = 0; sta < (1<<cnt); sta++) ans = min(ans, calc(sta)); printf("%d\n", ans); } return0; }