Takahashi has received an undirected graph with N vertices, numbered 1, 2, ..., N. The edges in this graph are represented by (ui, vi). There are no self-loops and multiple edges in this graph.
Based on this graph, Takahashi is now constructing a new graph with N2 vertices, where each vertex is labeled with a pair of integers (a, b) (1 ≤ a ≤ N, 1 ≤ b ≤ N). The edges in this new graph are generated by the following rule:
How many connected components are there in this new graph?
The input is given from Standard Input in the following format:
N M u1 v1 u2 v2 : uM vM
Print the number of the connected components in the graph constructed by Takahashi.
3 1 1 2
7
The graph constructed by Takahashi is as follows.
7 5 1 2 3 4 3 5 4 5 2 6
18
Subtask | Score |
---|---|
1 | 100 |
2 | 0 |