Hide

Problem E
Extended Braille

The Blind Association for Pretty Calligraphy is annoyed by the lack of emoticons and math symbols in the braille alphabet. Given that the braille alphabet is supported by the Unicode format, it only makes sense to make all Unicode characters supported in braille.

The goal is to extend the braille alphabet to include all Unicode characters. Of course, this will not fit in the standard $2 \times 3$ format, so using a bigger box is allowed. Important is that no two braille characters are the same up to translation, i.e., have the same shape. See Figure 1 for an example. You let a designer make up a large braille alphabet, and your job is to check how many unique shapes there are among the characters.

\includegraphics[width=0.3\textwidth ]{graphic}
Figure 1: Illustration of Sample Input 1:
two characters with the same shape.

Input

The input consists of:

  • One line with an integer $n$ ($1\leq n\leq 10^5$), the number of braille characters.

  • Then for each of the $n$ braille characters:

    • One line with an integer $m$ ($1 \leq m \leq 1000$), the number of dots.

    • $m$ lines, each with two integers $x$ and $y$ ($\left| x \right|, \left| y \right| \leq 1000$), the coordinates of the dots.

The total number of dots is at most $10^6$.

Output

Output the number of distinct braille characters up to translation.

Sample Input 1 Sample Output 1
2
2
0 2
1 1
2
0 1
1 0
1
Sample Input 2 Sample Output 2
2
3
-1 0
0 1
1 0
3
-1 0
0 -1
1 0
2

Please log in to submit a solution to this problem

Log in