시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
0.5 초 512 MB 0 0 0 0.000%

## 문제

Bobo invents a game and keeps playing.

A game $(\{a_1, a_2, \dots, a_m\}, \{b_1, b_2, \dots, b_l\})$ is played on the axis. First, bobo places $m$ balls at $a_1, a_2, \dots, a_m$, respectively. Then bobo digs $l$ holes at $b_1 + 0.5, b_2 + 0.5, \dots, b_l + 0.5$. Finally bobo pushes all balls forward so that the balls fall into the holes. bobo wins if and only if there are odd number of holes containing at least one ball.

Now bobo has $n$ sets $S_1, S_2, \dots, S_n$, and he wants to know how many games as $(S_i, S_j)$ $(i < j)$ he can win.

## 입력

The first line contains an integer $n$ ($2 \leq n \leq 5000$).

Each of the following $n$ lines contains an integer $k_i$, which denotes the size of $S_i$, followed by $k_i$ distinct integers $S_{i, 1}, S_{i, 2}, \dots, S_{i, k_i}$ which denotes the set $S_i$ ($1 \leq k_i \leq 50, 1 \leq S_{i, j} \leq 50$).

## 출력

A single integer denotes the number games bobo can win.

## 예제 입력 1

2
1 1
2 1 2


## 예제 출력 1

1


## 예제 입력 2

2
2 1 2
2 2 1


## 예제 출력 2

0