#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <vector>
#define mem(a, b) memset(a, b, sizeof(a))
using namespace std;
const int maxn = , INF = 0x7fffffff;
int pre[maxn], low[maxn], iscut[maxn];
vector<int> G[maxn];
int dfs_clock, n; int dfs(int u, int fa)
{
int lowu = pre[u] = ++dfs_clock;
int child = ;
for(int i=; i<G[u].size(); i++)
{
int v = G[u][i];
if(!pre[v])
{
child++;
int lowv = dfs(v, u);
lowu = min(lowv, lowu);
if(lowv >= pre[u])
iscut[u] = ;
}
else if(pre[v] < pre[u] && v != fa)
lowu = min(lowu, pre[v]);
}
if(fa < && child == ) iscut[u] = ;
low[u] = lowu;
return lowu;
} void init()
{
for(int i=; i<=n; i++) G[i].clear();
dfs_clock = ;
mem(pre, );
mem(iscut, );
mem(low, );
} int main()
{
int a, b;
char ch;
while(cin>> n && n)
{
int ret = ;
init();
while(scanf("%d",&a) && a)
{
while(scanf("%d%c", &b, &ch))
{
G[a].push_back(b);
G[b].push_back(a);
if(ch == '\n') break;
}
}
dfs(,-);
for(int i=; i<=n; i++)
if(iscut[i]) ret++;
cout<< ret <<endl; } return ;
}