To get into good physical shape, the cows decided to take up gymnastics! Farmer John assigns his favorite cow Bessie to train the other cows and evaluate their progress as they learn various gymnastic skills.
In each of the training sessions, Bessie ranks all cows according to their performance. Afterward, she becomes curious about how stable these rankings are. A pair of distinct cows is considered stable if one cow consistently performed better than the other in every session.
Help Bessie determine the total number of stable pairs.
The first line contains two positive integers k~(1 \le k \le 10) and n~(1 \le n \le 20). Each of the following lines contains the integers from to in some order, representing the ranking of the cows (the cows are labeled ). If appears before in one of these lines, it means that cow performed better than cow in that session.
Output the number of stable pairs.
The stable pairs are , , , and .
Example 1