#include <bits/stdc++.h>
using namespace std;
int main() {
  int x = 0, a = 0, b = 0, q = 0;
  int arr[100] = {0}, arr2[100] = {0};
  cin >> x;
  for (size_t i = 0; i < x; i++) {
    cin >> arr[i];
    b += a;
    cin >> a;
    for (size_t i = 0; i < a; i++) {
      cin >> arr2[i + b];
    }
  }
  b += a;
  for (size_t i = 0; i < x; i++) {
    for (size_t k = 0; k < b; k++) {
      if (arr2[i] == 0) {
        break;
      }
      if (!(k == i)) {
        if (arr[i] == arr2[k]) {
          arr2[k] = 0;
        }
      }
    }
  }
  for (size_t i = 0; i < b; i++) {
    for (size_t j = 0; j < b; j++) {
      if (arr2[i] == 0) {
        break;
      }
      if (!(i == j)) {
        if (arr2[i] == arr2[j]) {
          arr2[j] = 0;
        }
      }
    }
    if (!(arr2[i] == 0)) {
      q++;
    }
  }
  cout << q << endl;
}
