import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		List<Integer> list = new ArrayList<Integer>();
		int k1 = sc.nextInt();
		for(int tmp = 0; tmp<k1; tmp++) {
			int a1 = sc.nextInt();
			list.add(a1);
		}
		for(int tmp1 = 1; tmp1<n ;tmp1++) {
			List<Integer> compareList = new ArrayList<Integer>();
			int kn = sc.nextInt();
			for(int tmp2 = 0; tmp2<kn ; tmp2++) {
				int a = sc.nextInt();
				compareList.add(a);
			}
			List<Integer> removeList = new ArrayList<Integer>();
			for(int tmp3=0; tmp3< list.size() ; tmp3++) {
				 if(!compareList.contains(list.get(tmp3))){
					 removeList.add(tmp3);
				 }
			}
			Collections.sort(removeList, Collections.reverseOrder());
			for(int tmp4=0; tmp4 < removeList.size(); tmp4++) {
				int index = removeList.get(tmp4);
				list.remove(index);
			}
		}
		System.out.println(list.size());
	}
} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		List<Integer> list = new ArrayList<Integer>();
		int k1 = sc.nextInt();
		for(int tmp = 0; tmp<k1; tmp++) {
			int a1 = sc.nextInt();
			list.add(a1);
		}
		for(int tmp1 = 1; tmp1<n ;tmp1++) {
			List<Integer> compareList = new ArrayList<Integer>();
			int kn = sc.nextInt();
			for(int tmp2 = 0; tmp2<kn ; tmp2++) {
				int a = sc.nextInt();
				compareList.add(a);
			}
			List<Integer> removeList = new ArrayList<Integer>();
			for(int tmp3=0; tmp3< list.size() ; tmp3++) {
				 if(!compareList.contains(list.get(tmp3))){
					 removeList.add(tmp3);
				 }
			}
			Collections.sort(removeList, Collections.reverseOrder());
			for(int tmp4=0; tmp4 < removeList.size(); tmp4++) {
				int index = removeList.get(tmp4);
				list.remove(index);
			}
		}
		System.out.println(list.size());
	}
} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		List<Integer> list = new ArrayList<Integer>();
		int k1 = sc.nextInt();
		for(int tmp = 0; tmp<k1; tmp++) {
			int a1 = sc.nextInt();
			list.add(a1);
		}
		for(int tmp1 = 1; tmp1<n ;tmp1++) {
			List<Integer> compareList = new ArrayList<Integer>();
			int kn = sc.nextInt();
			for(int tmp2 = 0; tmp2<kn ; tmp2++) {
				int a = sc.nextInt();
				compareList.add(a);
			}
			List<Integer> removeList = new ArrayList<Integer>();
			for(int tmp3=0; tmp3< list.size() ; tmp3++) {
				 if(!compareList.contains(list.get(tmp3))){
					 removeList.add(tmp3);
				 }
			}
			Collections.sort(removeList, Collections.reverseOrder());
			for(int tmp4=0; tmp4 < removeList.size(); tmp4++) {
				int index = removeList.get(tmp4);
				list.remove(index);
			}
		}
		System.out.println(list.size());
	} main {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		List<Integer> list = new ArrayList<Integer>();
		int k1 = sc.nextInt();
		for(int tmp = 0; tmp<k1; tmp++) {
			int a1 = sc.nextInt();
			list.add(a1);
		}
		for(int tmp1 = 1; tmp1<n ;tmp1++) {
			List<Integer> compareList = new ArrayList<Integer>();
			int kn = sc.nextInt();
			for(int tmp2 = 0; tmp2<kn ; tmp2++) {
				int a = sc.nextInt();
				compareList.add(a);
			}
			List<Integer> removeList = new ArrayList<Integer>();
			for(int tmp3=0; tmp3< list.size() ; tmp3++) {
				 if(!compareList.contains(list.get(tmp3))){
					 removeList.add(tmp3);
				 }
			}
			Collections.sort(removeList, Collections.reverseOrder());
			for(int tmp4=0; tmp4 < removeList.size(); tmp4++) {
				int index = removeList.get(tmp4);
				list.remove(index);
			}
		}
		System.out.println(list.size());
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int m = sc.nextInt(); m sc.nextInt() sc.nextInt sc List<Integer> list = new ArrayList<Integer>(); list new ArrayList<Integer>() int k1 = sc.nextInt(); k1 sc.nextInt() sc.nextInt sc for(int tmp = 0; tmp<k1; tmp++) {
			int a1 = sc.nextInt();
			list.add(a1);
		} int tmp = 0; int tmp = 0; tmp 0 tmp<k1 tmp k1 tmp++ tmp++ tmp {
			int a1 = sc.nextInt();
			list.add(a1);
		} {
			int a1 = sc.nextInt();
			list.add(a1);
		} int a1 = sc.nextInt(); a1 sc.nextInt() sc.nextInt sc list.add(a1) list.add list a1 for(int tmp1 = 1; tmp1<n ;tmp1++) {
			List<Integer> compareList = new ArrayList<Integer>();
			int kn = sc.nextInt();
			for(int tmp2 = 0; tmp2<kn ; tmp2++) {
				int a = sc.nextInt();
				compareList.add(a);
			}
			List<Integer> removeList = new ArrayList<Integer>();
			for(int tmp3=0; tmp3< list.size() ; tmp3++) {
				 if(!compareList.contains(list.get(tmp3))){
					 removeList.add(tmp3);
				 }
			}
			Collections.sort(removeList, Collections.reverseOrder());
			for(int tmp4=0; tmp4 < removeList.size(); tmp4++) {
				int index = removeList.get(tmp4);
				list.remove(index);
			}
		} int tmp1 = 1; int tmp1 = 1; tmp1 1 tmp1<n tmp1 n tmp1++ tmp1++ tmp1 {
			List<Integer> compareList = new ArrayList<Integer>();
			int kn = sc.nextInt();
			for(int tmp2 = 0; tmp2<kn ; tmp2++) {
				int a = sc.nextInt();
				compareList.add(a);
			}
			List<Integer> removeList = new ArrayList<Integer>();
			for(int tmp3=0; tmp3< list.size() ; tmp3++) {
				 if(!compareList.contains(list.get(tmp3))){
					 removeList.add(tmp3);
				 }
			}
			Collections.sort(removeList, Collections.reverseOrder());
			for(int tmp4=0; tmp4 < removeList.size(); tmp4++) {
				int index = removeList.get(tmp4);
				list.remove(index);
			}
		} {
			List<Integer> compareList = new ArrayList<Integer>();
			int kn = sc.nextInt();
			for(int tmp2 = 0; tmp2<kn ; tmp2++) {
				int a = sc.nextInt();
				compareList.add(a);
			}
			List<Integer> removeList = new ArrayList<Integer>();
			for(int tmp3=0; tmp3< list.size() ; tmp3++) {
				 if(!compareList.contains(list.get(tmp3))){
					 removeList.add(tmp3);
				 }
			}
			Collections.sort(removeList, Collections.reverseOrder());
			for(int tmp4=0; tmp4 < removeList.size(); tmp4++) {
				int index = removeList.get(tmp4);
				list.remove(index);
			}
		} List<Integer> compareList = new ArrayList<Integer>(); compareList new ArrayList<Integer>() int kn = sc.nextInt(); kn sc.nextInt() sc.nextInt sc for(int tmp2 = 0; tmp2<kn ; tmp2++) {
				int a = sc.nextInt();
				compareList.add(a);
			} int tmp2 = 0; int tmp2 = 0; tmp2 0 tmp2<kn tmp2 kn tmp2++ tmp2++ tmp2 {
				int a = sc.nextInt();
				compareList.add(a);
			} {
				int a = sc.nextInt();
				compareList.add(a);
			} int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc compareList.add(a) compareList.add compareList a List<Integer> removeList = new ArrayList<Integer>(); removeList new ArrayList<Integer>() for(int tmp3=0; tmp3< list.size() ; tmp3++) {
				 if(!compareList.contains(list.get(tmp3))){
					 removeList.add(tmp3);
				 }
			} int tmp3=0; int tmp3=0; tmp3 0 tmp3< list.size() tmp3 list.size() list.size list tmp3++ tmp3++ tmp3 {
				 if(!compareList.contains(list.get(tmp3))){
					 removeList.add(tmp3);
				 }
			} {
				 if(!compareList.contains(list.get(tmp3))){
					 removeList.add(tmp3);
				 }
			} if(!compareList.contains(list.get(tmp3))){
					 removeList.add(tmp3);
				 } !compareList.contains(list.get(tmp3)) compareList.contains(list.get(tmp3)) compareList.contains compareList list.get(tmp3) list.get list tmp3 {
					 removeList.add(tmp3);
				 } removeList.add(tmp3) removeList.add removeList tmp3 Collections.sort(removeList, Collections.reverseOrder()) Collections.sort Collections removeList Collections.reverseOrder() Collections.reverseOrder Collections for(int tmp4=0; tmp4 < removeList.size(); tmp4++) {
				int index = removeList.get(tmp4);
				list.remove(index);
			} int tmp4=0; int tmp4=0; tmp4 0 tmp4 < removeList.size() tmp4 removeList.size() removeList.size removeList tmp4++ tmp4++ tmp4 {
				int index = removeList.get(tmp4);
				list.remove(index);
			} {
				int index = removeList.get(tmp4);
				list.remove(index);
			} int index = removeList.get(tmp4); index removeList.get(tmp4) removeList.get removeList tmp4 list.remove(index) list.remove list index System.out.println(list.size()) System.out.println System.out System System.out list.size() list.size list String[] args args public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		List<Integer> list = new ArrayList<Integer>();
		int k1 = sc.nextInt();
		for(int tmp = 0; tmp<k1; tmp++) {
			int a1 = sc.nextInt();
			list.add(a1);
		}
		for(int tmp1 = 1; tmp1<n ;tmp1++) {
			List<Integer> compareList = new ArrayList<Integer>();
			int kn = sc.nextInt();
			for(int tmp2 = 0; tmp2<kn ; tmp2++) {
				int a = sc.nextInt();
				compareList.add(a);
			}
			List<Integer> removeList = new ArrayList<Integer>();
			for(int tmp3=0; tmp3< list.size() ; tmp3++) {
				 if(!compareList.contains(list.get(tmp3))){
					 removeList.add(tmp3);
				 }
			}
			Collections.sort(removeList, Collections.reverseOrder());
			for(int tmp4=0; tmp4 < removeList.size(); tmp4++) {
				int index = removeList.get(tmp4);
				list.remove(index);
			}
		}
		System.out.println(list.size());
	}
} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		List<Integer> list = new ArrayList<Integer>();
		int k1 = sc.nextInt();
		for(int tmp = 0; tmp<k1; tmp++) {
			int a1 = sc.nextInt();
			list.add(a1);
		}
		for(int tmp1 = 1; tmp1<n ;tmp1++) {
			List<Integer> compareList = new ArrayList<Integer>();
			int kn = sc.nextInt();
			for(int tmp2 = 0; tmp2<kn ; tmp2++) {
				int a = sc.nextInt();
				compareList.add(a);
			}
			List<Integer> removeList = new ArrayList<Integer>();
			for(int tmp3=0; tmp3< list.size() ; tmp3++) {
				 if(!compareList.contains(list.get(tmp3))){
					 removeList.add(tmp3);
				 }
			}
			Collections.sort(removeList, Collections.reverseOrder());
			for(int tmp4=0; tmp4 < removeList.size(); tmp4++) {
				int index = removeList.get(tmp4);
				list.remove(index);
			}
		}
		System.out.println(list.size());
	}
} Main
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		List<Integer> list = new ArrayList<Integer>();
		int k1 = sc.nextInt();
		for(int tmp = 0; tmp<k1; tmp++) {
			int a1 = sc.nextInt();
			list.add(a1);
		}
		for(int tmp1 = 1; tmp1<n ;tmp1++) {
			List<Integer> compareList = new ArrayList<Integer>();
			int kn = sc.nextInt();
			for(int tmp2 = 0; tmp2<kn ; tmp2++) {
				int a = sc.nextInt();
				compareList.add(a);
			}
			List<Integer> removeList = new ArrayList<Integer>();
			for(int tmp3=0; tmp3< list.size() ; tmp3++) {
				 if(!compareList.contains(list.get(tmp3))){
					 removeList.add(tmp3);
				 }
			}
			Collections.sort(removeList, Collections.reverseOrder());
			for(int tmp4=0; tmp4 < removeList.size(); tmp4++) {
				int index = removeList.get(tmp4);
				list.remove(index);
			}
		}
		System.out.println(list.size());
	}
}