AT_abc469_d [ABC469D] The Big Two
Description
There is a game with $ N $ players $ 1,2,\dots,N $ .
This game is played in a format where two players face each other one-on-one.
A tournament among the $ N $ players was held $ M $ times, and the two players $ A_m $ and $ B_m $ advanced to the final of the $ m $ -th tournament.
Find the number of pairs of integers $ x $ and $ y $ satisfying the following conditions.
- $ 1 \leq x \lt y \leq N $
- In every tournament, at least one of players $ x $ and $ y $ advanced to the final.
Input Format
The input is given from Standard Input in the following format:
> $ N $ $ M $ $ A_1 $ $ B_1 $ $ A_2 $ $ B_2 $ $ \vdots $ $ A_M $ $ B_M $
Output Format
Output the answer in one line.
Explanation/Hint
### Sample Explanation 1
The conditions are satisfied when $ (x,y)=(2,3) $ , and not satisfied otherwise.
For example, in the fourth tournament, neither player $ 1 $ nor player $ 4 $ advanced to the final, so $ (x,y)=(1,4) $ does not satisfy the conditions.
### Sample Explanation 2
There are two pairs $ (x,y) $ satisfying the conditions: $ (1,2) $ and $ (1,4) $ .
### Constraints
- $ 2 \leq N \leq 2 \times 10^5 $
- $ 1 \leq M \leq 2 \times 10^5 $
- $ 1 \leq A_i \lt B_i \leq N $
- All input values are integers.