There are initially M (1≤M≤2⋅105) pairs of friends among FJ's N (2≤N≤2⋅105) cows labeled 1…N. The cows are leaving the farm for vacation one by one. On day i, the i-th cow leaves the farm, and all pairs of the i-th cow's friends still present on the farm become friends. How many new friendships are formed in total?
The first line contains N and M.
The next M lines contain two integers u_i and v_i denoting that cows u_i and v_i are friends (1≤u_i,v_i≤N, u_i=v_i). No unordered pair of cows appears more than once.
One line containing the total number of new friendships formed. Do not include pairs of cows that were already friends at the beginning.
On day 1, three new friendships are formed: (3,4), (3,7), and (4,7).
On day 3, two new friendships are formed: (4,5) and (5,7).