#C10422. Count Unique Locations based on Species Set

    ID: 39626 Type: Default 1000ms 256MiB

Count Unique Locations based on Species Set

Count Unique Locations based on Species Set

You are given a matrix representing species presence in different locations. Each row of the matrix indicates a location and contains a sequence of integers, where each integer can be 0 or 1, representing the absence or presence of a particular species respectively.

Your task is to determine the number of unique locations based on their species set. Two locations are considered the same if their corresponding rows (i.e. the set of species) are identical.

In mathematical terms, if we denote each row as a vector \(\mathbf{r}_i\), the answer is the size of the set \[ \{\mathbf{r}_1, \mathbf{r}_2, \dots, \mathbf{r}_n\}\ \] which is the number of distinct rows in the matrix.

Note that the matrix can be empty or a single row.

inputFormat

The first line contains an integer \(n\) representing the number of rows in the matrix.

The next \(n\) lines each contain a series of space-separated integers (0 or 1), representing a row of the matrix. All rows in a single test case will have the same number of elements.

If \(n = 0\), it means the matrix is empty.

outputFormat

Output a single integer denoting the number of unique locations (i.e. distinct rows) in the matrix.

## sample
3
1 0 0 1 0
1 0 0 1 0
0 1 1 0 1
2