#include using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(0); int T; cin >> T; vector used(60); for(int i = 0; i < T; i++){ int m, v; cin >> m; for(int j = 0; j < m; j++){ cin >> v; if(v == 1) used[j] = true; } } cout << count(used.begin(), used.end(), true) << '\n'; }