SOLVE
LATER
Given a graph having N vertices and an array A of M undirected edges, find the number of pairs of indices \((l,r), 1 \le l \le r \le M\), in A, such that if we consider edges only from \(A[l], A[l+1], ... ,A[r]\), then the graph is connected.
Input Format:
First line consists of two space separated integers denoting N and M.
Following M lines consists of two space separated u and v, denoting an undirected edge.
Output Format:
Print the required answer.
Constraints:
\(1 \le N, M \le 10^5\)
\(1 \le u, v \le N\)