import java.util.*;
import java.io.*;
import java.text.*;

class Point implements Comparable<Point> {
    public int x;
    public int y;

    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public int compareTo(Point p2) {
        if (this.x == p2.x) {
            return this.y - p2.y;
        }

        return this.x - p2.x;
    }
}

class PointList implements Comparable<PointList> {
    int n;
    Point[] points;

    public PointList(int n, Point[] points) {
        this.n = n;
        this.points = points;
    }

    public int compareTo(PointList other) {
        if (other.n < this.n) {
            return -1;
        } else if (other.n > this.n) {
            return 1;
        }
        for (int i = 0; i < n; i++) {
            int c = other.points[i].compareTo(this.points[i]);
            if (c < 0) {
                return -1;
            } else if (c > 0) {
                return 1;
            }
        }

        return 0;
    }
}

public class NickyEnMark{
    public static void main(String[] args) throws IOException {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
            String[] line = reader.readLine().split(" ");
            int n = Integer.parseInt(line[0]);
            PointList[] ans = new PointList[n];
            for (int i = 0; i < n; i++) {
                line = reader.readLine().split(" ");
                int m = Integer.parseInt(line[0]);
                Point[] points = new Point[m];
                int minx = 10001;
                int miny = 10001;

                for (int j = 0; j < m; j++) {
                    line = reader.readLine().split(" ");
                    int x = Integer.parseInt(line[0]);
                    int y = Integer.parseInt(line[1]);

                    if (x < minx) {
                        minx = x;
                    }
                    if (y < miny) {
                        miny = y;
                    }

                    points[j] = new Point(x, y);
                }

                for (int j = 0; j < m; j++) {
                    points[j].x -= minx;
                    points[j].y -= miny;
                }

                Arrays.sort(points);

                ans[i] = new PointList(m, points);
            }

            Arrays.sort(ans);

            int cnt = 1;
            for (int i = 1; i < n; i++) {
                if (ans[i].compareTo(ans[i-1]) != 0) {
                    cnt++;
                }
            }

            System.out.println(cnt);
        }
    }
}