Making Friends

아직 제출이 없습니다시간 제한3초메모리 제한1024 MB

문제

There are initially MM (1M21051\le M\le 2\cdot 10^5) pairs of friends among FJ's NN (2N21052\le N\le 2\cdot 10^5) cows labeled 1N1\dots N. The cows are leaving the farm for vacation one by one. On day ii, the ii-th cow leaves the farm, and all pairs of the ii-th cow's friends still present on the farm become friends. How many new friendships are formed in total?

입력

The first line contains NN and MM.

The next MM lines contain two integers u_iu\_i and v_iv\_i denoting that cows u_iu\_i and v_iv\_i are friends (1u_i,v_iN1\le u\_i,v\_i\le N, u_iv_iu\_i\neq 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 11, three new friendships are formed: (3,4)(3,4), (3,7)(3,7), and (4,7)(4,7).

On day 33, two new friendships are formed: (4,5)(4,5) and (5,7)(5,7).