#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<stack>
#include<cstring>
#include<set>
#include<iterator>
#include<list>
#include<deque>
#include<queue>
#include<map>
#include<cmath>
#include<sstream>
#include<cstdio>
#include<ctime>
#include<iomanip>
//#include<unordered_set>
using namespace std;
#define lowbit(x) x&(-x)
typedef long long ll;
typedef pair<int, int> P;
const int N = 2e4 + 10;
const int M = 1e4 + 10;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1e9 + 7;
vector<int> g[N];
int dp[N][2];
void dfs(int u,int fa)
{
dp[u][0] = 0, dp[u][1] = 1;
for (int i = 0; i < g[u].size(); i++)
{
int v = g[u][i];
if (v == fa)
continue;
dfs(v, u);
dp[u][0] += dp[v][1];
dp[u][1] += min(dp[v][0],dp[v][1]);
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int n;
while (cin >> n)
{
for (int i = 0; i < n; i++)
{
g[i].clear();
}
for (int t = 1; t <= n; t++)
{
string s;
cin >> s;
int u = 0;
int p = 0;
while (p < s.size())
{
if (s[p] == ':')
{
break;
}
u *= 10;
u += s[p] - '0';
p++;
}
int cnt = 0;
while (p < s.size())
{
if (isdigit(s[p]))
{
cnt *= 10;
cnt += s[p] - '0';
}
p++;
}
for (int i = 1; i <= cnt; i++)
{
int x;
cin >> x;
g[u].push_back(x);
g[x].push_back(u);
}
}
dfs(0, 0);
cout << min(dp[0][1], dp[0][0]) << endl;
}
return 0;
}