AT_abc466_d [ABC466D] Placing Rooks

Description

There is a grid with $ N $ rows and $ N $ columns. Initially, nothing is placed on the grid. Starting from this state, Takahashi performs $ M $ operations on the grid in order. The $ i $ -th operation $ (1\leq i\leq M) $ is as follows. - Remove all pieces placed on the cells in the $ R_i $ -th row from the top. - Next, remove all pieces placed on the cells in the $ C_i $ -th column from the left. - Finally, place a piece on the cell at the $ R_i $ -th row from the top and the $ C_i $ -th column from the left. Output the number of pieces placed on the grid after the $ M $ operations.

Input Format

The input is given from Standard Input in the following format: > $ N $ $ M $ $ R_1 $ $ C_1 $ $ R_2 $ $ C_2 $ $ \vdots $ $ R_M $ $ C_M $

Output Format

Output the number of pieces placed on the grid after the $ M $ operations.

Explanation/Hint

### Sample Explanation 1 Initially, nothing is placed on the grid with three rows and three columns, and pieces are removed and placed by each operation as follows. Below, the cell at the $ i $ -th row from the top and the $ j $ -th column from the left is denoted as cell $ (i,j) $ . - In the first operation, a piece is placed on cell $ (1,1) $ . - In the second operation, the piece is removed from cell $ (1,1) $ , and a piece is placed on cell $ (1,2) $ . - In the third operation, a piece is placed on cell $ (3,3) $ . - In the fourth operation, the pieces are removed from cell $ (1,2) $ and cell $ (3,3) $ , and a piece is placed on cell $ (3,2) $ . - In the fifth operation, a piece is placed on cell $ (1,3) $ . - In the sixth operation, the piece is removed from cell $ (1,3) $ , and a piece is placed on cell $ (1,3) $ again. In the final state, there is one piece each on cell $ (1,3) $ and cell $ (3,2) $ , so output $ 2 $ . ![](https://cdn.luogu.com.cn/upload/vjudge_pic/AT_abc466_d/5debbd0faa8dfad83c6d9bc231b7f2f3f29711c66d81a3d87a2b9681fc69cf90.png) ### Constraints - $ 1 \leq N \leq 3\times 10^5 $ - $ 1 \leq M \leq 3\times 10^5 $ - $ 1 \leq R_i \leq N $ - $ 1 \leq C_i \leq N $ - All input values are integers.