The directed graph is given. How many pairs of vertices have the common ancestor? The common ancestor of vertices and is a vertex for which and are reachable from .
The first line contains the number of vertices and number of edges in a graph. Each of the next lines contains two numbers from to . The pair means that an edge goes from to .
Print the number of pairs.