favorite We need a little bit of your help to keep things running, click on this banner to learn more

Azərbaycan Respublika Olimpiadasının yarımfinalı 2018-2019


The bishop in chess is a piece that attacks all squares on the same diagonal (on both diagonals).


Shakhriyar placed m bishops on a chessboard of size n * n. Now he wants to count the number of squares that are not attacked by bishops. Help Shahriyar in this matter.


First line contains two integers: the size n (1n106) of a chessboard and the number of bishops m (1m105). Each of the next m lines contains pair of integers: ri и ci (1ri, cin) - the numbers of row and column where the bishop number i is located. The bishops are numbered from 1 to m. All bishops are located on different squares.


Print the number of squares not attacked by the bishops.

Time limit 1 second
Memory limit 128 MiB
Input example #1
10 6
4 7
8 5
8 7
6 2
9 7
8 4
Output example #1
Input example #2
6 1
5 4
Output example #2
Input example #3
8 2
4 3
5 6
Output example #3
Source Semifinals, Azerbaijan Olympiad 2018-2019