Cowpatibility#10400

Cowpatibility

2 seconds
128 megabytes
Easy

It turns out that one factor matters far more than any other when determining whether two cows are compatible as potential friends: whether they like similar flavors of ice cream!

Each of Farmer John's cows has listed her five favorite flavors of ice cream. To keep the lists concise, each flavor is represented by a positive integer ID not exceeding 10^6. Two cows are compatible if their lists contain at least one common flavor.

Determine the number of pairs of cows that are not compatible.

Input

The first line contains an integer n~(2 \le n \le 5 \cdot 10^4). Each of the next lines contains distinct integers — the favorite ice cream flavors of one cow.

Output

Print one integer — the number of pairs of cows that are not compatible.

Examples

In this example, cow is not compatible with any of cows , , and , and cows and are not compatible either.

Example 1

Loading
Loading